Skip to content

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

@Quuxplusone

Description

@Quuxplusone

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions