Disable our non-standard delayed parsing of exception specifications. Delaying
the parsing of such things appears to be a conforming extension, but it breaks
libstdc++4.7's std::pair.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155975 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 082e335..7e2db69 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -4277,12 +4277,18 @@
                                IsCXX11MemberFunction);
       
       // Parse exception-specification[opt].
+      // FIXME: Remove the code to perform delayed parsing of exception
+      //        specifications.
+#if 0
       bool Delayed = (D.getContext() == Declarator::MemberContext &&
                       D.getDeclSpec().getStorageClassSpec()
                         != DeclSpec::SCS_typedef &&
                       !D.getDeclSpec().isFriendSpecified());
       for (unsigned i = 0, e = D.getNumTypeObjects(); Delayed && i != e; ++i)
         Delayed &= D.getTypeObject(i).Kind == DeclaratorChunk::Paren;
+#else
+      const bool Delayed = false;
+#endif
       ESpecType = tryParseExceptionSpecification(Delayed,
                                                  ESpecRange,
                                                  DynamicExceptions,
diff --git a/test/CXX/class/class.mem/p2.cpp b/test/CXX/class/class.mem/p2.cpp
index 02ef9d7..4aa4a5c 100644
--- a/test/CXX/class/class.mem/p2.cpp
+++ b/test/CXX/class/class.mem/p2.cpp
@@ -56,33 +56,3 @@
 
   template struct A2<int>;
 }
-
-namespace PR12629 {
-  struct S {
-    static int (f)() throw();
-    static int ((((((g))))() throw(U)));
-    int (*h)() noexcept(false);
-    static int (&i)() noexcept(true);
-    static int (*j)() throw(U); // expected-error {{type name}} \
-    // expected-error {{expected ')'}} expected-note {{to match}}
-
-    struct U {};
-  };
-  static_assert(noexcept(S::f()), "");
-  static_assert(!noexcept(S::g()), "");
-  static_assert(!noexcept(S().h()), "");
-  static_assert(noexcept(S::i()), "");
-}
-
-namespace PR12688 {
-  struct S {
-    // FIXME: Producing one error saying this can't have the same name
-    //        as the class because it's not a constructor, then producing
-    //        another error saying this can't have a return type because
-    //        it is a constructor, is redundant and inconsistent.
-    nonsense S() throw (more_nonsense); // \
-    // expected-error {{'nonsense'}} \
-    // expected-error {{has the same name as its class}} \
-    // expected-error {{constructor cannot have a return type}}
-  };
-}
diff --git a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
index ad4f406..030c90c 100644
--- a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
@@ -91,10 +91,11 @@
 
 namespace PR12564 {
   struct Base {
-    void bar(Base&) {}
+    void bar(Base&) {} // unexpected-note {{here}}
   };
 
   struct Derived : Base {
-    void foo(Derived& d) noexcept(noexcept(d.bar(d))) {}
+    // FIXME: This should be accepted.
+    void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // unexpected-error {{cannot bind to a value of unrelated type}}
   };
 }
diff --git a/test/SemaCXX/dependent-noexcept-unevaluated.cpp b/test/SemaCXX/dependent-noexcept-unevaluated.cpp
index fad8d09..0a3a8bb 100644
--- a/test/SemaCXX/dependent-noexcept-unevaluated.cpp
+++ b/test/SemaCXX/dependent-noexcept-unevaluated.cpp
@@ -23,7 +23,7 @@
 {
     T data[N];
 
-  void swap(array& a) noexcept(noexcept(::swap(declval<T&>(), declval<T&>())));
+    void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
 };
 
 struct DefaultOnly
@@ -38,4 +38,3 @@
 {
     array<DefaultOnly, 1> a, b;
 }
-
diff --git a/test/SemaCXX/implicit-exception-spec.cpp b/test/SemaCXX/implicit-exception-spec.cpp
index f3a070a..25316f8 100644
--- a/test/SemaCXX/implicit-exception-spec.cpp
+++ b/test/SemaCXX/implicit-exception-spec.cpp
@@ -40,9 +40,12 @@
 }
 
 namespace ExceptionSpecification {
-  struct Nested {
+  // A type is permitted to be used in a dynamic exception specification when it
+  // is still being defined, but isn't complete within such an exception
+  // specification.
+  struct Nested { // expected-note {{not complete}}
     struct T {
-      T() noexcept(!noexcept(Nested())); // expected-error{{exception specification is not available until end of class definition}}
+      T() noexcept(!noexcept(Nested())); // expected-error{{incomplete type}}
     } t;
   };
 }