summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/eh/template1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/eh/template1.C')
-rw-r--r--gcc/testsuite/g++.dg/eh/template1.C38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/eh/template1.C b/gcc/testsuite/g++.dg/eh/template1.C
new file mode 100644
index 000000000..2cbf9c698
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/template1.C
@@ -0,0 +1,38 @@
+// Test whether exception specifier dependent on template parameter
+// is accepted during template decl processing.
+// { dg-do run }
+
+extern "C" void abort();
+
+class A {};
+
+template <class T>
+struct B
+{
+ typedef A E;
+};
+
+template <class T>
+struct C
+{
+ typedef B<T> D;
+ typedef typename D::E E;
+ void f() throw(E) { throw E(); }
+};
+
+int main()
+{
+ int caught = 0;
+ try
+ {
+ C<int> x;
+ x.f();
+ }
+ catch (A)
+ {
+ ++caught;
+ }
+ if (caught != 1)
+ abort ();
+ return 0;
+}