Fix assertion failure with auto and nested initializer list; PR14272.

llvm-svn: 167506
This commit is contained in:
Eli Friedman 2012-11-06 23:56:42 +00:00
parent 7d6ee3e1b4
commit e43109557c
2 changed files with 7 additions and 2 deletions

View File

@ -3649,10 +3649,11 @@ Sema::DeduceAutoType(TypeSourceInfo *Type, Expr *&Init,
return DAR_Failed;
}
QualType DeducedType = Deduced[0].getAsType();
if (DeducedType.isNull())
if (Deduced[0].getKind() != TemplateArgument::Type)
return DAR_Failed;
QualType DeducedType = Deduced[0].getAsType();
if (InitList) {
DeducedType = BuildStdInitializerList(DeducedType, Loc);
if (DeducedType.isNull())

View File

@ -187,3 +187,7 @@ namespace rdar11948732 {
XCtorInit xc = { xi, xi };
}
}
namespace PR14272 {
auto x { { 0, 0 } }; // expected-error {{cannot deduce actual type for variable 'x' with type 'auto' from initializer list}}
}