[cfe-commits] r104299 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/warn-reorder-ctor-initialization.cpp
Douglas Gregor
dgregor at apple.com
Thu May 20 16:49:34 PDT 2010
Author: dgregor
Date: Thu May 20 18:49:34 2010
New Revision: 104299
URL: http://llvm.org/viewvc/llvm-project?rev=104299&view=rev
Log:
Fix a crasher in constructor-initializer reordering warnings (PR7179).
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/warn-reorder-ctor-initialization.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=104299&r1=104298&r2=104299&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu May 20 18:49:34 2010
@@ -2016,9 +2016,7 @@
// 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);
Modified: cfe/trunk/test/SemaCXX/warn-reorder-ctor-initialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-reorder-ctor-initialization.cpp?rev=104299&r1=104298&r2=104299&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-reorder-ctor-initialization.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-reorder-ctor-initialization.cpp Thu May 20 18:49:34 2010
@@ -120,3 +120,13 @@
};
};
}
+
+namespace PR7179 {
+ struct X
+ {
+ struct Y
+ {
+ template <class T> Y(T x) : X(x) { }
+ };
+ };
+}
More information about the cfe-commits
mailing list