mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-11 09:40:33 +08:00
typeck2.c (add_exception_specifier): Only require complete type if not in processing template declaration.
* typeck2.c (add_exception_specifier): Only require complete type if not in processing template declaration. * g++.dg/eh/template1.C: New test. From-SVN: r45032
This commit is contained in:
parent
fd1a3f7330
commit
baeb47327e
@ -1,3 +1,8 @@
|
||||
2001-08-19 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* typeck2.c (add_exception_specifier): Only require complete type if
|
||||
not in processing template declaration.
|
||||
|
||||
2001-08-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* decl.c: Cast argument to size_t, not HOST_WIDE_INT, in calls to
|
||||
|
@ -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;
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-08-19 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* g++.dg/eh/template1.C: New test.
|
||||
|
||||
2001-08-16 David Billinghurst <David.Billinghurst@riotinto.com>
|
||||
|
||||
* g77.f-torture/compile/pr3743.x: Do not return 1 for xfail.
|
||||
|
38
gcc/testsuite/g++.dg/eh/template1.C
Normal file
38
gcc/testsuite/g++.dg/eh/template1.C
Normal file
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user