https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71449
Bug ID: 71449 Summary: builtins accepted in default template arguments but rejected when explicitly specified Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- In C++ 98 mode, all versions of G++ reject the instantiation of template B below with an error but accepts the equivalent instantion of A. Either they both should be rejected, or they both should be accepted as they are in C++ 11 mode and later. Clang accepts the code in all C++ modes. $ cat cst.C && /home/msebor/build/gcc-6-branch/gcc/xgcc -B/home/msebor/build/gcc-6-branch/gcc -S -Wall -Wextra -Wpedantic -std=c++98 cst.C template <int = __builtin_parity (0)> struct A { }; A<> a; template <int> struct B { }; B<__builtin_parity (0)> b; cst.C:5:3: error: ‘int __builtin_parity(unsigned int)’ cannot appear in a constant-expression B<__builtin_parity (0)> b; ^~~~~~~~~~~~~~~~ cst.C:5:22: error: a function call cannot appear in a constant-expression B<__builtin_parity (0)> b; ^ cst.C:5:23: error: template argument 1 is invalid B<__builtin_parity (0)> b; ^