diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/tree.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/eh/throw3.C | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f37530d..aec7681 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-04-06 Jason Merrill <jason@redhat.com> + + PR c++/19312 + * tree.c (stabilize_init): Don't bother trying to stabilize + something with no side-effects. + 2005-04-05 Mark Mitchell <mark@codesourcery.com> PR c++/20763 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8b0d9aa..5d80d59 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2257,7 +2257,10 @@ stabilize_init (tree init, tree *initp) if (TREE_CODE (t) == COND_EXPR) return false; - stabilize_call (t, initp); + /* The TARGET_EXPR might be initializing via bitwise copy from + another variable; leave that alone. */ + if (TREE_SIDE_EFFECTS (t)) + stabilize_call (t, initp); } return true; diff --git a/gcc/testsuite/g++.dg/eh/throw3.C b/gcc/testsuite/g++.dg/eh/throw3.C new file mode 100644 index 0000000..3417eeb --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/throw3.C @@ -0,0 +1,8 @@ +// PR c++/19312 + +struct A {}; + +void foo(A a) +{ + throw (A)a; +} |