diff options
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 9bd89ef270..65516f2c29 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3283,6 +3283,8 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl, // thereof), the object shall be default-initialized; if the // object is of const-qualified type, the underlying class type // shall have a user-declared default constructor. + // + // FIXME: Diagnose the "user-declared default constructor" bit. if (getLangOptions().CPlusPlus) { QualType InitType = Type; if (const ArrayType *Array = Context.getAsArrayType(Type)) @@ -3303,12 +3305,18 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl, IK_Default, ConstructorArgs); - if (!Constructor || - InitializeVarWithConstructor(Var, Constructor, InitType, - move_arg(ConstructorArgs))) + // FIXME: Location info for the variable initialization? + if (!Constructor) Var->setInvalidDecl(); - else + else { + // FIXME: Cope with initialization of arrays + if (!Constructor->isTrivial() && + InitializeVarWithConstructor(Var, Constructor, InitType, + move_arg(ConstructorArgs))) + Var->setInvalidDecl(); + FinalizeVarWithDestructor(Var, InitType); + } } } } |