[cfe-commits] r155975 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/CXX/class/class.mem/p2.cpp test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp test/SemaCXX/dependent-noexcept-unevaluated.cpp test/SemaCXX/implicit-exception-spec.cpp

Richard Smith richard-llvm at metafoo.co.uk
Tue May 1 18:29:43 PDT 2012


Author: rsmith
Date: Tue May  1 20:29:43 2012
New Revision: 155975

URL: http://llvm.org/viewvc/llvm-project?rev=155975&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/test/CXX/class/class.mem/p2.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
    cfe/trunk/test/SemaCXX/dependent-noexcept-unevaluated.cpp
    cfe/trunk/test/SemaCXX/implicit-exception-spec.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=155975&r1=155974&r2=155975&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue May  1 20:29:43 2012
@@ -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,

Modified: cfe/trunk/test/CXX/class/class.mem/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.mem/p2.cpp?rev=155975&r1=155974&r2=155975&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/class.mem/p2.cpp (original)
+++ cfe/trunk/test/CXX/class/class.mem/p2.cpp Tue May  1 20:29:43 2012
@@ -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}}
-  };
-}

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp?rev=155975&r1=155974&r2=155975&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp Tue May  1 20:29:43 2012
@@ -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}}
   };
 }

Modified: cfe/trunk/test/SemaCXX/dependent-noexcept-unevaluated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/dependent-noexcept-unevaluated.cpp?rev=155975&r1=155974&r2=155975&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/dependent-noexcept-unevaluated.cpp (original)
+++ cfe/trunk/test/SemaCXX/dependent-noexcept-unevaluated.cpp Tue May  1 20:29:43 2012
@@ -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;
 }
-

Modified: cfe/trunk/test/SemaCXX/implicit-exception-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/implicit-exception-spec.cpp?rev=155975&r1=155974&r2=155975&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/implicit-exception-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/implicit-exception-spec.cpp Tue May  1 20:29:43 2012
@@ -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;
   };
 }





More information about the cfe-commits mailing list