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 | e00921a0a4484a4b6f7cc140232a2d1527293477 (patch) | |
tree | 440049ffc456571707eb30f6f430017d33195ab7 /clang/lib/Sema/SemaChecking.cpp | |
parent | b184a36aade7d299fd9ddbe305fd472788270fc3 (diff) | |
download | bcm5719-llvm-e00921a0a4484a4b6f7cc140232a2d1527293477.tar.gz bcm5719-llvm-e00921a0a4484a4b6f7cc140232a2d1527293477.zip |
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.
llvm-svn: 163964
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 0e6b5ec9a39..6d8d7f2c044 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/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(); } - |