From: Mark Mitchell Date: Sun, 17 Apr 2005 03:37:16 +0000 (+0000) Subject: re PR c++/21025 (ICE on template) X-Git-Tag: releases/gcc-3.4.4~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f939abddc98d270e4f409455e53eeb330f96fd20;p=thirdparty%2Fgcc.git re PR c++/21025 (ICE on template) PR c++/21025 * typeck.c (cxx_sizeof_or_alignof_type): Check whether the type to which sizeof/alignof is dependent, rather than just whether we are processing_template_decl. PR c++/21025 * g++.dg/template/sizeof9.C: New test. From-SVN: r98250 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f78e00e8bd7e..8b7d0b97d57c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2005-04-16 Mark Mitchell + + PR c++/21025 + * typeck.c (cxx_sizeof_or_alignof_type): Check whether the type to + which sizeof/alignof is dependent, rather than just whether we are + processing_template_decl. + 2005-04-06 Jason Merrill PR c++/19312 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index adcddaf7b3f1..648f95f3596c 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1216,7 +1216,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain) if (type == error_mark_node) return error_mark_node; - if (processing_template_decl) + if (dependent_type_p (type)) { value = build_min (op, size_type_node, type); TREE_READONLY (value) = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3f265edc037d..110fb3ab4deb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-16 Mark Mitchell + + PR c++/21025 + * g++.dg/template/sizeof9.C: New test. + 2005-04-04 Mark Mitchell PR c++/20679 diff --git a/gcc/testsuite/g++.dg/template/sizeof9.C b/gcc/testsuite/g++.dg/template/sizeof9.C new file mode 100644 index 000000000000..8d9ec95ae1f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sizeof9.C @@ -0,0 +1,6 @@ +// PR c++/21025 + +template struct X { char x[N]; }; +template X<1 + sizeof(T) - sizeof(T)> F(T const &); +template struct S { int d() { F(1); } }; +