aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 33e3921688..8d32578c98 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2174,13 +2174,16 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
if (Var->getStorageClass() != VarDecl::Extern &&
Var->getStorageClass() != VarDecl::PrivateExtern &&
InitType->isRecordType()) {
- const CXXConstructorDecl *Constructor
- = PerformInitializationByConstructor(InitType, 0, 0,
- Var->getLocation(),
+ const CXXConstructorDecl *Constructor = 0;
+ if (!DiagnoseIncompleteType(Var->getLocation(), InitType,
+ diag::err_invalid_incomplete_type_use))
+ Constructor
+ = PerformInitializationByConstructor(InitType, 0, 0,
+ Var->getLocation(),
SourceRange(Var->getLocation(),
Var->getLocation()),
- Var->getDeclName(),
- IK_Default);
+ Var->getDeclName(),
+ IK_Default);
if (!Constructor)
Var->setInvalidDecl();
}