mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-22 08:09:38 +08:00
new
From-SVN: r28764
This commit is contained in:
parent
b736d71688
commit
852be00c00
31
gcc/testsuite/g++.old-deja/g++.eh/fntry1.C
Normal file
31
gcc/testsuite/g++.old-deja/g++.eh/fntry1.C
Normal file
@ -0,0 +1,31 @@
|
||||
// Bug: g++ fails to treat function-try-blocks in ctors specially.
|
||||
// Submitted by Jason Merrill <jason@cygnus.com>
|
||||
|
||||
int c;
|
||||
int r;
|
||||
|
||||
struct A {
|
||||
int i;
|
||||
A(int j) { i = j; }
|
||||
~A() { c += i; }
|
||||
};
|
||||
|
||||
struct B: public A {
|
||||
A a;
|
||||
B() try : A(1), a(2)
|
||||
{ throw 1; }
|
||||
catch (...)
|
||||
{ if (c != 3) r |= 1; }
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
try
|
||||
{ B b; }
|
||||
catch (...)
|
||||
{ c = 0; }
|
||||
|
||||
if (c != 0) r |= 2;
|
||||
|
||||
return r;
|
||||
}
|
Loading…
Reference in New Issue
Block a user