Skip to content

[clang] Discarding a use of a [[nodiscard]] consteval function does not emit a nodiscard warning #141536

Open
@smallp-o-p

Description

@smallp-o-p

It emits an expression result unused warning instead. GCC emits the nodiscard warning.

[[nodiscard]] consteval int foo(){ return 1; }

[[nodiscard]] int foo2(){ return 1; }

int main(){
    foo(); // <-- emits an expression result unused warning
    foo2(); 
}

See: https://godbolt.org/z/9fEG8c5Mx

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconstevalC++20 consteval

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions