Skip to content

Clang should not warn about =delete("reason") in C++17 mode while claiming to support it #109311

Closed
@dangelog

Description

@dangelog

Clang 19 seems to define __cpp_deleted_function even in pre-C++26 modes. However using it results in a warning:

void f() = delete
#if __cpp_deleted_function >= 202403L
    ("reason")
#endif
;
<source>:3:6: warning: '= delete' with a message is a C++2c extension [-Wc++26-extensions]
    3 |     ("reason")
      |      ^~~~~~~~
1 warning generated.
Compiler returned: 0

https://godbolt.org/z/Esqh5aPfb

It sounds a bit strange to claim support for a given language feature (by setting the corresponding feature-define macro), but then warn if that feature is used? Would it be possible, in pre-C++26 modes, to support the syntax and warn but not set the macro?

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++17clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzergood first issuehttps://github.com/llvm/llvm-project/contribute

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions