forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
c++20clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
https://godbolt.org/z/r9o1b9qM8
https://eel.is/c++draft/depr.volatile.type#3 gives this Annex C example:
volatile struct amber jurassic(); // deprecated
void trex(volatile short left_arm, volatile short right_arm); // deprecated
void fly(volatile struct pterosaur* pteranodon); // OK
Clang trunk diagnoses the second line, but not the first. This is because the line of code that emits that volatile-return-type warning:
// C++2a [dcl.fct]p12:
// A volatile-qualified return type is deprecated
if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20)
S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
is incorrectly placed inside this conditional:
if ((T.getCVRQualifiers() || T->isAtomicType()) &&
!(S.getLangOpts().CPlusPlus &&
(T->isDependentType() || T->isRecordType()))) {
instead of outside, so it incorrectly fails to apply to volatile-qualified class types such as struct amber
.
Metadata
Metadata
Assignees
Labels
c++20clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer