Fix various problems with matching out-of-line definitions of static
class members to the corresponding in-class declaration.

Diagnose the erroneous use of 'static' on out-of-line definitions of
class members. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66740 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index f75b279..eaca56c 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -2,6 +2,11 @@
 namespace A {
   struct C {
     static int cx;
+
+    static int cx2;
+
+    static int Ag1();
+    static int Ag2();
   };
   int ax;
   void Af();
@@ -11,6 +16,15 @@
 ::A::ax::undef ex3; // expected-error {{expected a class or namespace}} expected-error {{invalid token after top level declarator}}
 A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{invalid token after top level declarator}}
 
+int A::C::Ag1() { return 0; }
+
+static int A::C::Ag2() { return 0; } // expected-error{{'static' can not be specified on an out-of-line static member}}
+
+int A::C::cx = 17;
+
+
+static int A::C::cx2 = 17; // expected-error{{'static' can not be specified on an out-of-line static member}}
+
 class C2 {
   void m(); // expected-note{{member declaration nearly matches}}
 
diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp
index 4007f23..8db2bc3 100644
--- a/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/test/SemaTemplate/nested-name-spec-template.cpp
@@ -33,8 +33,7 @@
 
 N::M::template Promote; // expected-error{{expected '<' after 'template Promote' in nested name specifier}} \
 // expected-error{{C++ requires a type specifier for all declarations}} \
-// expected-error{{redefinition of 'Promote' as different kind of symbol}} \
-// expected-error{{no member named 'Promote'}}
+// expected-error{{redefinition of 'Promote' as different kind of symbol}}
 
 namespace N {
   template<typename T> struct A;