summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-10-28 06:18:02 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-10-28 06:18:02 +0000
commit2f36dae5c01d46c8c71af594601f125a604226a1 (patch)
tree570759e781e3ed05a3725a659dcd6ce965e37386 /clang/lib/Sema/SemaDecl.cpp
parent3589dd74acc93c371344752602bea02904c774fb (diff)
downloadbcm5719-llvm-2f36dae5c01d46c8c71af594601f125a604226a1.tar.gz
bcm5719-llvm-2f36dae5c01d46c8c71af594601f125a604226a1.zip
When determining whether to try evaluating the initializer of a variable, check
whether the initializer is value-dependent rather than whether we are in a dependent context. This allows us to detect some errors sooner, and fixes a crash-on-invalid if a dependent type leaks out to a non-dependent context in error recovery. llvm-svn: 166898
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 35761903106..6eef427731b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7201,7 +7201,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
Expr *Init = var->getInit();
bool IsGlobal = var->hasGlobalStorage() && !var->isStaticLocal();
- if (!var->getDeclContext()->isDependentContext() && Init) {
+ if (Init && !Init->isValueDependent()) {
if (IsGlobal && !var->isConstexpr() &&
getDiagnostics().getDiagnosticLevel(diag::warn_global_constructor,
var->getLocation())
OpenPOWER on IntegriCloud