Author: rsmith Date: Fri Oct 11 10:59:09 2019 New Revision: 374580 URL: http://llvm.org/viewvc/llvm-project?rev=374580&view=rev Log: Suppress false-positive -Wdeprecated-volatile warning from __is_*_assignable(volatile T&, U).
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/test/SemaCXX/deprecated.cpp Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=374580&r1=374579&r2=374580&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Oct 11 10:59:09 2019 @@ -5243,7 +5243,13 @@ static bool EvaluateBinaryTypeTrait(Sema 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) Modified: cfe/trunk/test/SemaCXX/deprecated.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deprecated.cpp?rev=374580&r1=374579&r2=374580&view=diff ============================================================================== --- cfe/trunk/test/SemaCXX/deprecated.cpp (original) +++ cfe/trunk/test/SemaCXX/deprecated.cpp Fri Oct 11 10:59:09 2019 @@ -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}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits