diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-10-23 20:04:55 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-10-23 20:04:55 +0200 |
commit | 22531fb1957ca61debd68c6d3bbc16899b907ba8 (patch) | |
tree | d9c6d5bdb49861f832355ea4a64a1fa01384e283 /gcc | |
parent | 8d672b2640e869e85781f02cd36c1a7cc6165ce8 (diff) | |
download | gcc-22531fb1957ca61debd68c6d3bbc16899b907ba8.zip gcc-22531fb1957ca61debd68c6d3bbc16899b907ba8.tar.gz gcc-22531fb1957ca61debd68c6d3bbc16899b907ba8.tar.bz2 |
re PR c++/54844 (ice tsubst_copy, at cp/pt.c:12352)
PR c++/54844
* pt.c (tsubst_copy, tsubst_copy_and_build) <case SIZEOF_EXPR>: Use
tsubst instead of tsubst_copy* on types.
* g++.dg/template/sizeof14.C: New test.
From-SVN: r192736
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/sizeof14.C | 4 |
4 files changed, 22 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bb06612..1cad796 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2012-10-23 Jakub Jelinek <jakub@redhat.com> + PR c++/54844 + * pt.c (tsubst_copy, tsubst_copy_and_build) <case SIZEOF_EXPR>: Use + tsubst instead of tsubst_copy* on types. + PR c++/54988 * decl2.c (cplus_decl_attributes): Don't return early if attributes is NULL. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7e8d8b0..1ff1c73 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12104,8 +12104,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) } if (SIZEOF_EXPR_TYPE_P (t)) { - r = tsubst_copy (TREE_TYPE (TREE_OPERAND (t, 0)), - args, complain, in_decl); + r = tsubst (TREE_TYPE (TREE_OPERAND (t, 0)), + args, complain, in_decl); r = build1 (NOP_EXPR, r, error_mark_node); r = build1 (SIZEOF_EXPR, tsubst (TREE_TYPE (t), args, complain, in_decl), r); @@ -13533,10 +13533,13 @@ tsubst_copy_and_build (tree t, { ++cp_unevaluated_operand; ++c_inhibit_evaluation_warnings; - op1 = tsubst_copy_and_build (op1, args, complain, in_decl, - /*function_p=*/false, - /*integral_constant_expression_p=*/ - false); + if (TYPE_P (op1)) + op1 = tsubst (op1, args, complain, in_decl); + else + op1 = tsubst_copy_and_build (op1, args, complain, in_decl, + /*function_p=*/false, + /*integral_constant_expression_p=*/ + false); --cp_unevaluated_operand; --c_inhibit_evaluation_warnings; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0779858..8267df6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-23 Jakub Jelinek <jakub@redhat.com> + + PR c++/54844 + * g++.dg/template/sizeof14.C: New test. + 2012-10-23 Ian Bolton <ian.bolton@arm.com> Jim MacArthur <jim.macarthur@arm.com> Chris Schlumberger-Socha <chris.schlumberger-socha@arm.com> diff --git a/gcc/testsuite/g++.dg/template/sizeof14.C b/gcc/testsuite/g++.dg/template/sizeof14.C new file mode 100644 index 0000000..8f4020465 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sizeof14.C @@ -0,0 +1,4 @@ +// PR c++/54844 +// { dg-do compile } +template <int N> int fn () { return sizeof (double); } +int var = fn <0> (); |