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

            Bug ID: 86431
           Summary: Legal code?
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follow:

 struct A { 
 static int const B = sizeof B; 
 };

g++ rejects the code:

error: 'B' was not declared in this scope
  static int const B = sizeof B;

The PoD should should be immediately after "B" and before the initializer, as
far as I can see, so this is valid code. BTW, clang++ accepts the code.

Reply via email to