http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56871
Bug #: 56871 Summary: [c++11] Specialization of constexpr Templated Function Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: david.narv...@computer.org Consider the code below template<typename T> constexpr int foo(T) { return 0; }; template<> int foo(int) { return 1; } Compiling this code with g++-4.8.0 -Wall -c -std=c++0x bug.cpp throws the following error: bug.cpp:2:23: error: redeclaration ‘constexpr int foo(T) [with T = int]’ differs in ‘constexpr’ template<> int foo(int) { return 1; } ^ bug.cpp:1:36: error: from previous declaration ‘constexpr int foo(T) [with T = int]’ template<typename T> constexpr int foo(T) { return 0; }; Yet, the C++ standard (section 7.1.5) says that an explicit specialization can differ from the template declaration with respect to the constexpr specifier.