Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-format] attribute on constructor causes -> to be incorrectly inferred as trailing return type in base class argument list #86559

Closed
joelhock opened this issue Mar 25, 2024 · 0 comments · Fixed by #86624

Comments

@joelhock
Copy link

joelhock commented Mar 25, 2024

version 17.0.1 correctly formats this:

// --dump-config has
// AttributeMacros:
//  - _COLD
#define _COLD __attribute__((cold))

class C {
  public:
    __attribute__((cold)) C() : Base(obj->func()) {}  // OK
    _COLD C() : Base(obj->func()) {}  // OK
    C() : Base(obj->func()) {}  // OK
};

whereas 18.1 and HEAD (d99cfa0) incorrectly think -> is introducing a trailing return type when the constructor has an attribute attached to it:

// --dump-config has
// AttributeMacros:
//  - _COLD
#define _COLD __attribute__((cold))

class C {
  public:
    __attribute__((cold)) C() : Base(obj -> func()) {}  // WRONG
    _COLD C() : Base(obj -> func()) {}  // WRONG
    C() : Base(obj->func()) {}  // OK
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants