Don't bother to perform any initialization for a variable declaration

of class type whose default constructor is trivial. Should un-break
testing on x86_64-pc-linux-gnu.

llvm-svn: 81405
This commit is contained in:
Douglas Gregor 2009-09-09 23:58:28 +00:00
parent da3e7547fb
commit 60e40bb301
1 changed files with 12 additions and 4 deletions

View File

@ -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);
}
}
}
}