https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69731
Bug ID: 69731 Summary: Inconsistent SFINAE in interaction with variable templates Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lucdanton at free dot fr Target Milestone: --- Created attachment 37641 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37641&action=edit Minimal testcase It appears that GCC behaves differently depending on how SFINAE is performed (e.g. how a trait is written), and how a trait is used(!) at the constraint site (using regular enable_if_t techniques). In one particular case one of the techniques loops until the instantiation limit depth is reached, but only if the short form is used on the site. Regardless of what /should/ happen (which I have no idea about), I believe GCC should consistently either loop or terminate. For what it's worth Clang accepts all cases for both forms. I am using 6.0.0 20160208, the testcase is compiled with alternatively: g++-trunk -std=c++1z -DSHORT testcase.cpp g++-trunk -std=c++1z testcase.cpp The first command results in constraints that use trait_v<X, Y> variable templates and succeeds. The second command results in constraints that use the trait<X, Y>::value static members and hits the limit.