[Bug c++/87464] Gcc reports hard error instead of SFINAE out the related method
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 28 12:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87464
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Alex from comment #0)
> Created attachment 44765 [details]
> test code
>
> The following code works with clang (7.x, 8.x) & VC (2015).
>
> Trouble: GCC reports a hard error instead of SFINAE-drop the methods:
No it doesn't. It reports a hard error as the reason for SFINAEing away those
functions.
> 1. "tst.cpp:27:149: error: no type named ‘type’ in ‘struct
> std::enable_if<false, int>’";
> 2. "tst.cpp:36:4: error: no type named ‘type’ in ‘struct
> std::enable_if<false, SfinaeTest<int>&>’"
>
> The clang and VC compilers do compile this places (besides the expected
> errors in main())
So they compile it, except that they don't.
GCC is telling you why the SFINAE constraint failed. If you add another
constructor that could be used instead you won't get errors.
More information about the Gcc-bugs
mailing list