https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69731
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed| |2016-07-22 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to fail| |5.3.0, 6.1.0, 7.0 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed with 5.x and current trunk (7.0) with the following output. Clang 3.8 and EDG eccp 4.11 accept the code. y.C: In substitution of ‘template<class Arg> void accept(Arg) [with Arg = ex2&]’: y.C:34:56: recursively required by substitution of ‘template<class Arg> void accept(Arg) [with Arg = ex2&]’ y.C:34:56: required by substitution of ‘template<class Arg, typename enable_if<(! trait2<ex2&, Arg>::value)>::type <anonymous> > ex2::ex2(Arg) [with Arg = int; typename enable_if<(! trait2<ex2&, Arg>::value)>::type <anonymous> = <missing>]’ y.C:65:12: required from here y.C:34:56: fatal error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) struct trait2<Type, Init, void_t<decltype( accept<Type>(declval<Init>()) )>>: true_type {}; ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ compilation terminated.