https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68586
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This passes with trunk with -std=c++03, because the difference comes from maybe_constant_value in convert_nontype_argument: 6260 /* In C++11, integral or enumeration non-type template arguments can be 6261 arbitrary constant expressions. Pointer and pointer to 6262 member arguments can be general constant expressions that evaluate 6263 to a null value, but otherwise still need to be of a specific form. */ 6264 if (cxx_dialect >= cxx11) 6265 { 6266 if (TREE_CODE (expr) == PTRMEM_CST) 6267 /* A PTRMEM_CST is already constant, and a valid template 6268 argument for a parameter of pointer to member type, we just want 6269 to leave it in that form rather than lower it to a 6270 CONSTRUCTOR. */; 6271 else if (INTEGRAL_OR_ENUMERATION_TYPE_P (type)) 6272 expr = maybe_constant_value (expr); gcc-5 compiles this testcase fine even with -std=c++11 though. It looks as if the difference is that for const_decl 'x' gcc-6's maybe_constant_value returns "1" (integer_cst) while gcc-5's maybe_constant_value returns "1" (enumeral_type E).