This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/72076] cmath: illegal instruction (constexpr)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72076

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Thorsten Hirsch from comment #6)
> One by one. :)
> I mean this snippet:
> 
>   template<typename _Tp>
> 
>     constexpr
> 
>     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
> 
>                                     int>::__type
> 
>     ilogb(_Tp __x)
> 
>     { return __builtin_ilogb(__x); }
> 
> 
> Is this valid? Or should there be an "int" or "float" after the "constexpr"
> in line 2?

    typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
                                    int>::__type

is a type, it is either SFINAE or is int.  Basically the template is rejected
as a substitution failure and not considered or is the type is an int.
This is standard C++98ism.  One which is confusing but used so you can do
overloads which are not considered part of the overload class.
See https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error for more
information on that.

Again do you have a preprocessed source for the failure you are seeing and what
is the full error message?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]