Issue 176128
Summary Clang accepts non-conforming [[deprecated]] attribute with parenthesized string literal
Labels clang
Assignees
Reporter vrukesh
    **What code / commands /steps will reproduce the problem?**
Compile the below sample code for clang std c++17.

_[[deprecated(("Use still allowed, but discouraged"))]] int a = 13;
int main() {}_

**Compiler Explorer link:** 
https://godbolt.org/z/eYWWGjsjM

**What is the expected result?**
As per C++17 standard,

_The attribute-token deprecated can be used to mark names and entities whose use is still allowed, but is
discouraged for some reason. [ Note: In particular, deprecated is appropriate for names and entities that
are deemed obsolescent or unsafe. — end note ] It shall appear at most once in each attribute-list. An
attribute-argument-clause may be present and, if present, it shall have the form:
( string-literal )
[ Note: The string-literal in the attribute-argument-clause could be used to explain the rationale for deprecation
and/or to suggest a replacing entity. — end note ]_

So, to meet the C++17 standard, Clang should throw diagnostic warning or error.

**What happens instead?**

Both Clang and GCC accept code, and do not emit any diagnostic warning or error. This does not conform to the C++17 standard.

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

Reply via email to