Fix a crasher in constructor-initializer reordering warnings (PR7179).

llvm-svn: 104299
This commit is contained in:
Douglas Gregor 2010-05-20 23:49:34 +00:00
parent c13a9e7382
commit aabdfcb29e
2 changed files with 11 additions and 3 deletions

View File

@ -2016,9 +2016,7 @@ DiagnoseBaseOrMemInitializerOrder(Sema &SemaRef,
// If we didn't find this initializer, it must be because we
// scanned past it on a previous iteration. That can only
// happen if we're out of order; emit a warning.
if (IdealIndex == NumIdealInits) {
assert(PrevInit && "initializer not found in initializer list");
if (IdealIndex == NumIdealInits && PrevInit) {
Sema::SemaDiagnosticBuilder D =
SemaRef.Diag(PrevInit->getSourceLocation(),
diag::warn_initializer_out_of_order);

View File

@ -120,3 +120,13 @@ namespace test3 {
};
};
}
namespace PR7179 {
struct X
{
struct Y
{
template <class T> Y(T x) : X(x) { }
};
};
}