diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2022-03-30 07:12:04 -0400 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2022-03-30 07:12:49 -0400 |
commit | cf4a67bcbbb109347b1e2d6cedf69bae142a182f (patch) | |
tree | 2da978a3efec8c4b7df946674a10b6a88ada4d8f /clang/lib/Sema/SemaExprMember.cpp | |
parent | 4a33b9ece076d85be5f73e3511f7f64269c74888 (diff) | |
download | llvm-cf4a67bcbbb109347b1e2d6cedf69bae142a182f.zip llvm-cf4a67bcbbb109347b1e2d6cedf69bae142a182f.tar.gz llvm-cf4a67bcbbb109347b1e2d6cedf69bae142a182f.tar.bz2 |
Don't diagnostic atomic object access as UB in an unevaluated context
We started diagnosing this situation with a more clear diagnostic
message, but it was pointed out that unevaluated contexts don't really
have the undefined behavior property as there is no runtime access
involved.
This augments the changes in https://reviews.llvm.org/D122656 to not
diagnose in an unevaluated context.
Diffstat (limited to 'clang/lib/Sema/SemaExprMember.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprMember.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 152b39d..cb95f70 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -1298,7 +1298,8 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R, // lvalue. Because this is inherently unsafe as an atomic operation, the // warning defaults to an error. if (const auto *ATy = BaseType->getAs<AtomicType>()) { - S.Diag(OpLoc, diag::warn_atomic_member_access); + S.DiagRuntimeBehavior(OpLoc, nullptr, + S.PDiag(diag::warn_atomic_member_access)); BaseType = ATy->getValueType().getUnqualifiedType(); BaseExpr = ImplicitCastExpr::Create( S.Context, IsArrow ? S.Context.getPointerType(BaseType) : BaseType, |