Skip to content

"'ownership_returns' attribute takes no more than 1 argument" is wrong #137896

Closed
@halbi2

Description

@halbi2

https://godbolt.org/z/nz8vMME7r

[[clang::ownership_returns()]] int *bad0(int);
[[clang::ownership_returns(x)]] int *good1(int);
[[clang::ownership_returns(x,1)]] int *good2(int);
[[clang::ownership_returns(x,1,1)]] int *bad3(int);

Issues only two errors, on bad0 and bad3. good2 is accepted. But for bad3 the error message is:

<source>:4:3: error: 'ownership_returns' attribute takes no more than 1 argument
    4 | [[clang::ownership_returns(x,1,1)]] int *bad3(int);
      |   ^

I think this is a bug. "1 argument" should be "2 arguments".

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions