From: jakub Date: Sun, 19 Aug 2001 18:35:06 +0000 (+0000) Subject: * typeck2.c (add_exception_specifier): Only require complete type if X-Git-Tag: upstream/4.9.2~92526 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba1f2de0e828ea1c3c45c821a03a2bf00ffe858b;p=platform%2Fupstream%2Flinaro-gcc.git * typeck2.c (add_exception_specifier): Only require complete type if not in processing template declaration. * g++.dg/eh/template1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45032 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3fa4455..e513bdb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-08-19 Jakub Jelinek + + * typeck2.c (add_exception_specifier): Only require complete type if + not in processing template declaration. + 2001-08-18 Kaveh R. Ghazi * decl.c: Cast argument to size_t, not HOST_WIDE_INT, in calls to diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 09621d4..5ba4611 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1293,9 +1293,11 @@ add_exception_specifier (list, spec, complain) ok = is_ptr; else if (TREE_CODE (core) == TEMPLATE_TYPE_PARM) ok = 1; + else if (processing_template_decl) + ok = 1; else ok = COMPLETE_TYPE_P (complete_type (core)); - + if (ok) { tree probe; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ae2e15..babe91e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-08-19 Jakub Jelinek + + * g++.dg/eh/template1.C: New test. + 2001-08-16 David Billinghurst * g77.f-torture/compile/pr3743.x: Do not return 1 for xfail. diff --git a/gcc/testsuite/g++.dg/eh/template1.C b/gcc/testsuite/g++.dg/eh/template1.C new file mode 100644 index 0000000..2cbf9c6 --- /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 +struct B +{ + typedef A E; +}; + +template +struct C +{ + typedef B D; + typedef typename D::E E; + void f() throw(E) { throw E(); } +}; + +int main() +{ + int caught = 0; + try + { + C x; + x.f(); + } + catch (A) + { + ++caught; + } + if (caught != 1) + abort (); + return 0; +}