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

            Bug ID: 101302
           Summary: attribute-specifier-seq in noptr-new-declarator not
                    parsed
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

I think the gnu::packed attribute should be on the int[10] array type and
clang++ accepts it, but g++ rejects it with
attr4.C: In function ‘void foo()’:
attr4.C:4:27: error: ‘gnu’ was not declared in this scope
    4 |   auto a = new int [10] [[gnu::packed]];
      |                           ^~~
attr4.C:4:30: error: expected ‘,’ before ‘::’ token
    4 |   auto a = new int [10] [[gnu::packed]];
      |                              ^~
      |                              ,
attr4.C:4:30: error: expected identifier before ‘::’ token
    4 |   auto a = new int [10] [[gnu::packed]];
      |                              ^~
attr4.C: In lambda function:
attr4.C:4:39: error: expected ‘{’ before ‘]’ token
    4 |   auto a = new int [10] [[gnu::packed]];
      |                                       ^
attr4.C: In function ‘void foo()’:
attr4.C:4:26: error: expression in new-declarator must have integral or
enumeration type
    4 |   auto a = new int [10] [[gnu::packed]];
      |                          ^

void
foo ()
{
  auto a = new int [10] [[gnu::packed]];
}

Reply via email to