]> granicus.if.org Git - clang/commitdiff
Fix a crasher in constructor-initializer reordering warnings (PR7179).
authorDouglas Gregor <dgregor@apple.com>
Thu, 20 May 2010 23:49:34 +0000 (23:49 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 20 May 2010 23:49:34 +0000 (23:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104299 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
test/SemaCXX/warn-reorder-ctor-initialization.cpp

index 05ce9e35e8ff1e036b230949b70660366a4034c2..6d907ed4e0114cb338c81de942088064789df63a 100644 (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);
index 3ff01af3627cf0cc6d37983706d3b33e2b78cc6b..8c254e5515bfca17e59176ef77de74e3a77455f2 100644 (file)
@@ -120,3 +120,13 @@ namespace test3 {
     };
   };
 }
+
+namespace PR7179 {
+  struct X
+  {
+    struct Y
+    {
+      template <class T> Y(T x) : X(x) { }
+    };
+  };
+}