Quuxplusone / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
https://p1144.godbolt.org/z/jf67zx5hq
Other
1 stars 2 forks source link

Bogus error "'visibility' attribute takes one argument" in C++03 mode only #28

Closed Quuxplusone closed 8 months ago

Quuxplusone commented 9 months ago

https://godbolt.org/z/bMoKTsc38

struct [[gnu::visibility("default")]] S {};

Clang 17 introduced the ability to parse C++11-style [[attributes]] even in C++98 mode. Compile the line above with -std=c++11 and it compiles fine. But compile it with -std=c++03 and you get a bogus error:

<source>:1:10: error: 'visibility' attribute takes one argument
    1 | struct [[gnu::visibility("default")]] S {};
      |          ^

There is one argument there! So Clang shouldn't be complaining, should it?

Quuxplusone commented 8 months ago

Fixed by b873847a53ae638e2146e3657fe33efe30c2afe1!