summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-10-29 18:26:47 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-10-29 18:26:47 +0000
commitbf83009c7faafe321dd09f15b2ce8f8847d2ded0 (patch)
tree387c6d8687172568ca342d6d11f985624b02e52a /clang/lib
parent908c936fa9239da91962503527dd701ebe71a9b4 (diff)
downloadbcm5719-llvm-bf83009c7faafe321dd09f15b2ce8f8847d2ded0.tar.gz
bcm5719-llvm-bf83009c7faafe321dd09f15b2ce8f8847d2ded0.zip
Partially roll back r166898; it exposed a bug in the standard.
The problem is as follows: C++11 has contexts which are not potentially-evaluated, and yet in which we are required or encouraged to perform constant evaluation. In such contexts, we are not permitted to implicitly define special member functions for literal types, therefore we cannot evalaute those constant expressions. Punt on this in one more context for now by skipping checking constexpr variable initializers if they occur in dependent contexts. llvm-svn: 166956
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 0eb123105b9..52ee80f8336 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7200,7 +7200,8 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
Expr *Init = var->getInit();
bool IsGlobal = var->hasGlobalStorage() && !var->isStaticLocal();
- if (Init && !Init->isValueDependent()) {
+ if (!var->getDeclContext()->isDependentContext() &&
+ Init && !Init->isValueDependent()) {
if (IsGlobal && !var->isConstexpr() &&
getDiagnostics().getDiagnosticLevel(diag::warn_global_constructor,
var->getLocation())
OpenPOWER on IntegriCloud