From 6deb820a1d2f98e8eda7df1da057cecce8655289 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 2 May 2012 01:29:43 +0000 Subject: [PATCH] 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 --- lib/Parse/ParseDecl.cpp | 6 ++++ test/CXX/class/class.mem/p2.cpp | 30 ------------------- .../expr.prim/expr.prim.general/p3-0x.cpp | 5 ++-- .../dependent-noexcept-unevaluated.cpp | 3 +- test/SemaCXX/implicit-exception-spec.cpp | 7 +++-- 5 files changed, 15 insertions(+), 36 deletions(-) diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 082e335aae..7e2db69fd6 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -4277,12 +4277,18 @@ void Parser::ParseFunctionDeclarator(Declarator &D, 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 02ef9d7bbc..4aa4a5c6f1 100644 --- a/test/CXX/class/class.mem/p2.cpp +++ b/test/CXX/class/class.mem/p2.cpp @@ -56,33 +56,3 @@ namespace test3 { template struct A2; } - -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 ad4f4064c2..030c90c525 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 Static { 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 fad8d0918d..0a3a8bb250 100644 --- a/test/SemaCXX/dependent-noexcept-unevaluated.cpp +++ b/test/SemaCXX/dependent-noexcept-unevaluated.cpp @@ -23,7 +23,7 @@ struct array { T data[N]; - void swap(array& a) noexcept(noexcept(::swap(declval(), declval()))); + void swap(array& a) noexcept(noexcept(swap(declval(), declval()))); }; struct DefaultOnly @@ -38,4 +38,3 @@ int main() { array a, b; } - diff --git a/test/SemaCXX/implicit-exception-spec.cpp b/test/SemaCXX/implicit-exception-spec.cpp index f3a070a01f..25316f8d51 100644 --- a/test/SemaCXX/implicit-exception-spec.cpp +++ b/test/SemaCXX/implicit-exception-spec.cpp @@ -40,9 +40,12 @@ namespace InClassInitializers { } 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; }; } -- 2.40.0