diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-15 06:09:58 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-15 06:09:58 +0000 |
commit | bc57b108b2253e26b83768dba196c28564952f18 (patch) | |
tree | 60857949ef502f062cd8fff6a9812220816a6c28 /lib/Sema/SemaChecking.cpp | |
parent | e6664f43bb3ed95c9cd059fac89740cb2d976c15 (diff) |
const _Atomic(T) is not an atomic type, so do not allow it as the type 'A' in
C11 7.17's atomic operations. GNU's __atomic_* builtins do allow const-qualified
atomics, though (!!) so don't restrict those.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163964 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 0e6b5ec9a3..6d8d7f2c04 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -742,6 +742,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult, << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } + if (AtomTy.isConstQualified()) { + Diag(DRE->getLocStart(), diag::err_atomic_op_needs_non_const_atomic) + << Ptr->getType() << Ptr->getSourceRange(); + return ExprError(); + } ValType = AtomTy->getAs<AtomicType>()->getValueType(); } @@ -6124,4 +6129,3 @@ void Sema::CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr, << ArgumentExpr->getSourceRange() << TypeTagExpr->getSourceRange(); } - |