From: Jakub Jelinek Date: Thu, 6 Dec 2007 09:33:26 +0000 (+0100) Subject: re PR c++/34336 (4.2.2 internal error in stabilize_expr) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28267cfcce273646cf39bca5401428cb53429481;p=gcc.git re PR c++/34336 (4.2.2 internal error in stabilize_expr) PR c++/34336 * tree.c (stabilize_call, stabilize_init): Do nothing if processing_template_decl. * g++.dg/template/new8.C: New test. From-SVN: r130645 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98316fedad7..f7e8904909f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-12-06 Jakub Jelinek + + PR c++/34336 + * tree.c (stabilize_call, stabilize_init): Do nothing if + processing_template_decl. + 2007-12-05 Jakub Jelinek PR c++/34271 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index c885d088878..843f6c45590 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2602,8 +2602,11 @@ stabilize_call (tree call, tree *initp) int i; int nargs = call_expr_nargs (call); - if (call == error_mark_node) - return; + if (call == error_mark_node || processing_template_decl) + { + *initp = NULL_TREE; + return; + } gcc_assert (TREE_CODE (call) == CALL_EXPR); @@ -2662,7 +2665,7 @@ stabilize_init (tree init, tree *initp) *initp = NULL_TREE; - if (t == error_mark_node) + if (t == error_mark_node || processing_template_decl) return true; if (TREE_CODE (t) == INIT_EXPR diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e63a9f1f153..94e727337de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-12-06 Jakub Jelinek + + PR c++/34336 + * g++.dg/template/new8.C: New test. + 2007-12-06 Tobias Burnus PR fortran/34333 diff --git a/gcc/testsuite/g++.dg/template/new8.C b/gcc/testsuite/g++.dg/template/new8.C new file mode 100644 index 00000000000..b8f3f97e6dc --- /dev/null +++ b/gcc/testsuite/g++.dg/template/new8.C @@ -0,0 +1,29 @@ +// PR c++/34336 +// { dg-do compile } + +struct A; + +template +struct S +{ + T *m; + T &operator* () { return *m; } +}; + +struct B +{ + B (const A &); +}; + +template +struct C +{ + C (); + S c; +}; + +template +C::C () +{ + B *b = new B (*c); +}