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
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 0e6b5ec..6d8d7f2 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -742,6 +742,11 @@
<< 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 @@
<< ArgumentExpr->getSourceRange()
<< TypeTagExpr->getSourceRange();
}
-