From ad00b8db9ae8be85946993a52b14a16e85754aac Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 4 Mar 2011 10:18:07 -0500 Subject: [PATCH] re PR c++/47971 (ICE: in tsubst_copy, at cp/pt.c:11725 on valid code) PR c++/47971 * pt.c (tsubst_copy_and_build) [PSEUDO_DTOR_EXPR]: Use tsubst for type. (tsubst_copy) [default]: Just return t if !ENABLE_CHECKING. From-SVN: r170677 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 6 ++++-- gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/template/pseudodtor6.C | 9 +++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/pseudodtor6.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ce4ade16a84..572090ad9a7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-03-04 Jason Merrill + PR c++/47971 + * pt.c (tsubst_copy_and_build) [PSEUDO_DTOR_EXPR]: Use tsubst for type. + (tsubst_copy) [default]: Just return t if !ENABLE_CHECKING. + PR c++/46220 * search.c (check_final_overrider): Allow pointer to same incomplete class type with different cv-quals. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c52bb74eba8..dfc972870f4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11727,7 +11727,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) return t; default: - gcc_unreachable (); + /* We shouldn't get here, but keep going if !ENABLE_CHECKING. */ + gcc_checking_assert (false); + return t; } } @@ -12984,7 +12986,7 @@ tsubst_copy_and_build (tree t, return finish_pseudo_destructor_expr (RECUR (TREE_OPERAND (t, 0)), RECUR (TREE_OPERAND (t, 1)), - RECUR (TREE_OPERAND (t, 2))); + tsubst (TREE_OPERAND (t, 2), args, complain, in_decl)); case TREE_LIST: { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c56bea48f04..1e541053e13 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-03-04 Jason Merrill + * g++.dg/template/pseudodtor6.C: New. + * g++.dg/inherit/covariant19.C: New. 2011-03-04 Richard Guenther diff --git a/gcc/testsuite/g++.dg/template/pseudodtor6.C b/gcc/testsuite/g++.dg/template/pseudodtor6.C new file mode 100644 index 00000000000..4438b6ffb33 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pseudodtor6.C @@ -0,0 +1,9 @@ +// PR c++/47971 + +template struct S +{ + typedef double T; + S () { T ().~T (); } +}; + +S s; -- 2.30.2