[Bug c++/58541] [c++11] Bogus "error: redeclaration ... differs in ‘constexpr’"

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 13 03:42:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58541

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-05-13
                 CC|                            |msebor at gcc dot gnu.org
             Blocks|                            |55004
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.3, 5.3.0, 6.1.0, 7.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  There is no requirement that the namespace-scope definition of a
static constexpr class member say its constexpr.  Today's trunk (7.0) fails
with the following error.  All supported versions of GCC fail to compile the
test case.  If I'm reading the logs right, the error was introduced in r166013.

$ cat xx.cpp && gcc -S -Wall -Wextra -Wpedantic -o/dev/null -std=c++11 xx.cpp
struct X {
  static constexpr const char x[] = "x";
};

const char X::x[];

xx.cpp:5:17: error: ‘constexpr’ needed for in-class initialization of static
data member ‘const char X::x [2]’ of non-integral type [-fpermissive]
 const char X::x[];
                 ^


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues


More information about the Gcc-bugs mailing list