Issue 176136
Summary Clang accepts duplicate maybe_unused without diagnostic
Labels clang
Assignees
Reporter vrukesh
    **What code / commands /steps will reproduce the problem?**
Compile the sample code:

_int foo([[maybe_unused, maybe_unused]] int a) {
    return 1;
}

int main() {
    return foo(3);
}_


**Compiler Explorer link:** 
https://godbolt.org/z/67EWeqYnE

**What is the expected result?**
As per C++17 standard,
_The attribute-token maybe_unused indicates that a name or entity is possibly intentionally unused. It shall
appear at most once in each attribute-list and no attribute-argument-clause shall be present._

**What happens instead?**

GCC throws diagnostic warning. It meets C++17 standard.
Clang passes the compilation without any diagnostic warning or error. This doesnot meet C++17 standard.

To meet C++17 standard, Clang should diagnose the duplicate maybe_unused attribute with diagnostic warning or error.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to