This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68926] decltype and sfinae to check for template instance availability fails to compile
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Dec 2015 11:58:05 +0000
- Subject: [Bug c++/68926] decltype and sfinae to check for template instance availability fails to compile
- Auto-submitted: auto-generated
- References: <bug-68926-4 at http dot gcc dot gnu dot org/bugzilla/>
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
}