Suppress false-positive -Wdeprecated-volatile warning from __is_*_assignable(volatile T&, U).
llvm-svn: 374580
This commit is contained in:
parent
af6c15f679
commit
1e3a8d12a1
|
@ -5243,7 +5243,13 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, QualType LhsT,
|
|||
Sema::ContextRAII TUContext(Self, Self.Context.getTranslationUnitDecl());
|
||||
ExprResult Result = Self.BuildBinOp(/*S=*/nullptr, KeyLoc, BO_Assign, &Lhs,
|
||||
&Rhs);
|
||||
if (Result.isInvalid() || SFINAE.hasErrorOccurred())
|
||||
if (Result.isInvalid())
|
||||
return false;
|
||||
|
||||
// Treat the assignment as unused for the purpose of -Wdeprecated-volatile.
|
||||
Self.CheckUnusedVolatileAssignment(Result.get());
|
||||
|
||||
if (SFINAE.hasErrorOccurred())
|
||||
return false;
|
||||
|
||||
if (BTT == BTT_IsAssignable)
|
||||
|
|
|
@ -178,6 +178,8 @@ namespace DeprecatedVolatile {
|
|||
n /= 2; // cxx20-warning {{compound assignment to object of volatile-qualified type 'volatile int' is deprecated}}
|
||||
n %= 42; // cxx20-warning {{compound assignment to object of volatile-qualified type 'volatile int' is deprecated}}
|
||||
|
||||
(void)__is_trivially_assignable(volatile int&, int); // no warning
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
struct X { int a, b; };
|
||||
volatile auto [x, y] = X{1, 2}; // cxx20-warning {{volatile qualifier in structured binding declaration is deprecated}}
|
||||
|
|
Loading…
Reference in New Issue