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 c++/68926] decltype and sfinae to check for template instance availability fails to compile


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-12-16
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed, compiles correctly with clang, EDG and MSVC.

Reduced to remove the library header:

struct true_type { static constexpr bool value = true; };
struct false_type { static constexpr bool value = false; };

template<bool Cond> struct enable_if { using type = void; };
template<> struct enable_if<false> { };

template<typename T, typename U> struct is_same : false_type { };
template<typename T> struct is_same<T, T> : true_type { };

template<typename T>
typename enable_if<is_same<int, T>::value>::type
func();

template<typename T, typename = decltype(func<T>)>
true_type test(T);

false_type test(...);

int main()
{
   decltype(test(0))::value;   // ok
   decltype(test(0.f))::value; // error
}

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