[Bug c++/68926] decltype and sfinae to check for template instance availability fails to compile
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 16 11:58:00 GMT 2015
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
}
More information about the Gcc-bugs
mailing list