Diagnose misordered initializers in constructor templates immediately instead of
when they're instantiated.  Merge the note into the -Wreorder warning;  it
doesn't really contribute much, and it was splitting a thought across diagnostics
anyway.  Don't crash in the parser when a constructor's initializers end in a
comma and there's no body;  the recovery here is still terrible, but anything's
better than a crash.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100922 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index 8b23e13..a22c417 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -87,12 +87,11 @@
 
 struct Current : Derived {
   int Derived;
-  Current() : Derived(1), ::Derived(), // expected-warning {{member 'Derived' will be initialized after}} \
-                                       // expected-note {{base '::Derived'}} \
-                                       // expected-warning {{base class '::Derived' will be initialized after}}
+  Current() : Derived(1), ::Derived(), // expected-warning {{field 'Derived' will be initialized after base '::Derived'}} \
+                                       // expected-warning {{base class '::Derived' will be initialized after base 'Derived::V'}}
                           ::Derived::Base(), // expected-error {{type '::Derived::Base' is not a direct or virtual base of 'Current'}}
                            Derived::Base1(), // expected-error {{type 'Derived::Base1' is not a direct or virtual base of 'Current'}}
-                           Derived::V(), // expected-note {{base 'Derived::V'}}
+                           Derived::V(),
                            ::NonExisting(), // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}}
                            INT::NonExisting()  {} // expected-error {{expected a class or namespace}} \
                                                   // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}}
diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
index f419156..15e0867 100644
--- a/test/SemaCXX/warn-reorder-ctor-initialization.cpp
+++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
@@ -6,12 +6,13 @@
 
 class complex : public BB, BB1 { 
 public: 
-  complex() : s2(1),  // expected-warning {{member 's2' will be initialized after}}
-              s1(1) , // expected-note {{field s1}} 
-              s3(3),  // expected-warning {{member 's3' will be initialized after}} 
-              BB1(),   // expected-note {{base 'BB1'}}  \
-                      // expected-warning {{base class 'BB1' will be initialized after}}
-              BB() {}  // expected-note {{base 'BB'}}
+  complex()
+    : s2(1), // expected-warning {{field 's2' will be initialized after field 's1'}}
+      s1(1),
+      s3(3), // expected-warning {{field 's3' will be initialized after base 'BB1'}} 
+      BB1(), // expected-warning {{base class 'BB1' will be initialized after base 'BB'}}
+      BB()
+  {}
   int s1;
   int s2;
   int s3;
@@ -44,14 +45,12 @@
 
 
 struct D : public A, public B { 
-  D()  : A(), V() {   } // expected-warning {{base class 'A' will be initialized after}} \
-                        // expected-note {{base 'V'}}
+  D()  : A(), V() {   } // expected-warning {{base class 'A' will be initialized after base 'V'}}
 };
 
 
 struct E : public A, public B, private virtual V { 
-  E()  : A(), V() {  } // expected-warning {{base class 'A' will be initialized after}} \
-                       // expected-note {{base 'V'}}
+  E()  : A(), V() {  } // expected-warning {{base class 'A' will be initialized after base 'V'}}
 };
 
 
@@ -64,13 +63,11 @@
 };
 
 struct F : public A1, public B1, private virtual V { 
-  F()  : A1(), V() {  } // expected-warning {{base class 'A1' will be initialized after}} \
-                        // expected-note {{base 'V'}}
+  F()  : A1(), V() {  } // expected-warning {{base class 'A1' will be initialized after base 'V'}}
 };
 
 struct X : public virtual A, virtual V, public virtual B {
-  X(): A(), V(), B() {} // expected-warning {{base class 'A' will be initialized after}} \
-                        // expected-note {{base 'V'}}
+  X(): A(), V(), B() {} // expected-warning {{base class 'A' will be initialized after base 'V'}}
 };
 
 class Anon {
@@ -80,8 +77,8 @@
 class Anon2 {
   int c; union {int a,b;}; int d;
   Anon2() : c(2),
-            d(10), // expected-warning {{member 'd' will be initialized after}}
-            b(1) {} // expected-note {{field b}}
+            d(10), // expected-warning {{field 'd' will be initialized after field 'b'}}
+            b(1) {}
 };
 class Anon3 {
   union {int a,b;};
@@ -95,7 +92,19 @@
 struct S3 { };
 
 struct S4: virtual S3, S2 {
-  S4() : S2(), // expected-warning {{base class 'T1::S2' will be initialized after}}
-    S3() { }; // expected-note {{base 'T1::S3'}}
+  S4() : S2(), // expected-warning {{base class 'T1::S2' will be initialized after base 'T1::S3'}}
+    S3() { };
 };
 }
+
+namespace test2 {
+  struct Foo { Foo(); };
+  class A {
+    template <class T> A(T *t) :
+      y(),  // expected-warning {{field 'y' will be initialized after field 'x'}}
+      x()
+    {}
+    Foo x;
+    Foo y;
+  };
+}
diff --git a/test/SemaTemplate/instantiate-member-initializers.cpp b/test/SemaTemplate/instantiate-member-initializers.cpp
index ca94bef..45503b3 100644
--- a/test/SemaTemplate/instantiate-member-initializers.cpp
+++ b/test/SemaTemplate/instantiate-member-initializers.cpp
@@ -10,8 +10,8 @@
 A<void*> a1; // expected-note{{in instantiation of member function 'A<void *>::A' requested here}}
 
 template<typename T> struct B {
-  B() : b(1), // expected-warning {{member 'b' will be initialized after}}
-    a(2) { } // expected-note {{field a}}
+  B() : b(1), // expected-warning {{field 'b' will be initialized after field 'a'}}
+    a(2) { }
   
   int a;
   int b;