aboutsummaryrefslogtreecommitdiff
path: root/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
commit1432a43e3076eec84967305bd85bace3a6e9102b (patch)
tree112d10cc911d1b2e37f4d255728b42b7a71542aa /lib/Sema/SemaDecl.cpp
parent623ef4bf31bc5ec14ed9b5645921a0a2e0d00ee4 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166898 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3576190310..6eef427731 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/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())