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

            Bug ID: 58541
           Summary: [c++11] Bogus "error: redeclaration ... differs in
                    ‘constexpr’"
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Test:

struct X {
 static constexpr const char x[] = "x";
};
const char X::x[];

Using g++ (GCC) 4.9.0 20130923 (experimental):

g++ -c t.cc -std=c++11
t.cc:4:17: error: redeclaration 'X::x' differs in 'constexpr'
 const char X::x[];
                 ^
t.cc:2:30: error: from previous declaration 'X::x'
  static constexpr const char x[] = "x";
                              ^
t.cc:4:17: error: declaration of 'constexpr const char X::x [2]' outside of
class is not definition [-fpermissive]
 const char X::x[];
                 ^

Richard Smith says:

  There is no rule requiring successive declarations of variables to agree in
'constexpr'ness (this rule only applies to functions).


Google ref: b/10930205

Reply via email to