summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-11-09 23:03:14 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-11-09 23:03:14 +0000
commitde63d36fb2101573f03e5104a0511a378e2473ac (patch)
tree1305bb5e666126168fe63ccd78a41dd203508ee8 /clang/lib/Sema
parent069a2df6fd0fa2b545116df27b9d2b3adb3e8464 (diff)
downloadbcm5719-llvm-de63d36fb2101573f03e5104a0511a378e2473ac.tar.gz
bcm5719-llvm-de63d36fb2101573f03e5104a0511a378e2473ac.zip
PR13788: Don't perform checks on the initializer of a dependently-typed
variable. Previously we didn't notice the type was dependent if the only dependence came from an array bound. Patch by Brian Brooks! llvm-svn: 167642
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 628d2245a87..0092d5dab1f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7219,8 +7219,8 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
// All the following checks are C++ only.
if (!getLangOpts().CPlusPlus) return;
- QualType baseType = Context.getBaseElementType(var->getType());
- if (baseType->isDependentType()) return;
+ QualType type = var->getType();
+ if (type->isDependentType()) return;
// __block variables might require us to capture a copy-initializer.
if (var->hasAttr<BlocksAttr>()) {
@@ -7229,8 +7229,6 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
// Regardless, we don't want to ignore array nesting when
// constructing this copy.
- QualType type = var->getType();
-
if (type->isStructureOrClassType()) {
SourceLocation poi = var->getLocation();
Expr *varRef =new (Context) DeclRefExpr(var, false, type, VK_LValue, poi);
@@ -7248,6 +7246,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
Expr *Init = var->getInit();
bool IsGlobal = var->hasGlobalStorage() && !var->isStaticLocal();
+ QualType baseType = Context.getBaseElementType(type);
if (!var->getDeclContext()->isDependentContext() &&
Init && !Init->isValueDependent()) {
OpenPOWER on IntegriCloud