After upgrading from gcc 6.1 to to 7.1, some of my code no longer compiles:
include\jw\vector2.h: In member function 'constexpr jw::vector2<T>& jw::vector2<T>::operator=(const jw::vector2<U>&)':
include\jw\vector2.h(32,119): error : expected primary-expression before '>' token
template <typename U> constexpr vector2& operator=(const vector2<U>& rhs) noexcept { return *this = rhs.cast<T>(); };
^
include\jw\vector2.h(32,121): error : expected primary-expression before ')' token
template <typename U> constexpr vector2& operator=(const vector2<U>& rhs) noexcept { return *this = rhs.cast<T>(); };
^
I'm getting about ~20 of these errors in various classes using template functions. In this case vector2
is a simple template class, defined as:
template <typename T> struct vector2
{ /* ... */ }
and cast
is a member function of vector2
, defined as:
template <typename U> constexpr vector2<U> cast() const noexcept
{
return vector2<U>{ std::is_integral<U>::value ? this->rounded() : *this };
}
Frankly I don't see the problem here and the error message doesn't point at any obvious issues. Any ideas why this suddenly fails?