[Bug c++/71790] New: C++ attributes on expression statements result in compile error

tcorbat at hsr dot ch gcc-bugzilla@gcc.gnu.org
Thu Jul 7 08:27:00 GMT 2016


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.


More information about the Gcc-bugs mailing list