summaryrefslogtreecommitdiffstats
path: root/test/CXX
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-04-16 18:27:27 +0000
committerDouglas Gregor <dgregor@apple.com>2012-04-16 18:27:27 +0000
commit74e2fc332e07c76d4e69ccbd0e9e47a0bafd3908 (patch)
treee13935dca7e6eaa9e934215f7517e99dd591fcb4 /test/CXX
parent0f90590c96375052c67116f620fafa2b1eadb41e (diff)
Implement the last part of C++ [class.mem]p2, delaying the parsing of
exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154844 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/class/class.mem/p2.cpp27
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp10
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p5.cpp2
3 files changed, 38 insertions, 1 deletions
diff --git a/test/CXX/class/class.mem/p2.cpp b/test/CXX/class/class.mem/p2.cpp
index 09040d859c..0a823f4c1f 100644
--- a/test/CXX/class/class.mem/p2.cpp
+++ b/test/CXX/class/class.mem/p2.cpp
@@ -29,3 +29,30 @@ namespace test2 {
A<int> x;
};
}
+
+namespace test3 {
+ struct A {
+ struct B {
+ void f() throw(A);
+ void g() throw(B);
+ };
+
+ void f() throw(A);
+ void g() throw(B);
+ };
+
+ template<typename T>
+ struct A2 {
+ struct B {
+ void f1() throw(A2);
+ void f2() throw(A2<T>);
+ void g() throw(B);
+ };
+
+ void f1() throw(A2);
+ void f2() throw(A2<T>);
+ void g() throw(B);
+ };
+
+ template struct A2<int>;
+}
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 f00e358f3a..ad4f4064c2 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
@@ -88,3 +88,13 @@ namespace Static {
X2<int>().g(0);
}
}
+
+namespace PR12564 {
+ struct Base {
+ void bar(Base&) {}
+ };
+
+ struct Derived : Base {
+ void foo(Derived& d) noexcept(noexcept(d.bar(d))) {}
+ };
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
index 6955219e7a..726e22227e 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -164,7 +164,7 @@ template<typename T, typename... Types>
// FIXME: this should test that the diagnostic reads "type contains..."
struct alignas(Types) TestUnexpandedDecls : T{ // expected-error{{expression contains unexpanded parameter pack 'Types'}}
void member_function(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
- void member_function () throw(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ void member_function () throw(Types); // expected-error{{exception type contains unexpanded parameter pack 'Types'}}
operator Types() const; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
Types data_member; // expected-error{{data member type contains unexpanded parameter pack 'Types'}}
static Types static_data_member; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}