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

            Bug ID: 71790
           Summary: C++ attributes on expression statements result in
                    compile error
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tcorbat at hsr dot ch
  Target Milestone: ---

I encounter problems when using C++ attributes on expression statements while
compiling with GCC. For example:

int main(int argc, char **argv) {
  int i{};
  [[arbitrary_attribute]]
  i++;
}

I get the following error:
../main.cpp: In function β€˜int main(int, char**)’:
../main.cpp:3:3: error: expected identifier before β€˜[’ token
  [[arbitrary_attribute]]
   ^

I would expect the compiler to issue a warning but otherwise ignore the unknown
attribute.

Reply via email to