summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-31 06:31:19 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-31 06:31:19 +0000
commit77be48ac4744554b08b9a6587a4ade8601c9cc90 (patch)
treec1087a1b801effbd2418a6b09d1e749410ea6590 /clang/lib/AST/ExprConstant.cpp
parentc537bd2da4c07c56dfa49a8bc593e4e61a84c5d2 (diff)
downloadbcm5719-llvm-77be48ac4744554b08b9a6587a4ade8601c9cc90.tar.gz
bcm5719-llvm-77be48ac4744554b08b9a6587a4ade8601c9cc90.zip
PR18097: Support initializing an _Atomic(T) from an object of C++ class type T
or a class derived from T. We already supported this when initializing _Atomic(T) from T for most (and maybe all) other reasonable values of T. llvm-svn: 214390
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 9bd630a272f..538fc57672f 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1353,6 +1353,11 @@ static bool CheckConstantExpression(EvalInfo &Info, SourceLocation DiagLoc,
return false;
}
+ // We allow _Atomic(T) to be initialized from anything that T can be
+ // initialized from.
+ if (const AtomicType *AT = Type->getAs<AtomicType>())
+ Type = AT->getValueType();
+
// Core issue 1454: For a literal constant expression of array or class type,
// each subobject of its value shall have been initialized by a constant
// expression.
OpenPOWER on IntegriCloud