re PR c++/55685 (ICE: canonical types differ for identical types)

PR c++/55685
	* pt.c (tsubst_copy_and_build): Don't use SIZEOF_EXPR_TYPE_P in
	templates.

From-SVN: r194517
This commit is contained in:
Jason Merrill 2012-12-14 23:02:52 -05:00 committed by Jason Merrill
parent 71d1d77cfb
commit 1c95972133
3 changed files with 18 additions and 1 deletions

View file

@ -1,5 +1,9 @@
2012-12-14 Jason Merrill <jason@redhat.com>
PR c++/55685
* pt.c (tsubst_copy_and_build): Don't use SIZEOF_EXPR_TYPE_P in
templates.
PR c++/42315
* decl.c (maybe_deduce_size_from_array_init): Don't change the
variable type.

View file

@ -13563,7 +13563,7 @@ tsubst_copy_and_build (tree t,
{
if (TREE_CODE (r) != SIZEOF_EXPR || TYPE_P (op1))
{
if (TYPE_P (op1))
if (!processing_template_decl && TYPE_P (op1))
{
r = build_min (SIZEOF_EXPR, size_type_node,
build1 (NOP_EXPR, op1, error_mark_node));

View file

@ -0,0 +1,13 @@
// PR c++/55685
typedef __SIZE_TYPE__ size_t;
template <size_t T, size_t U>
struct A;
template <typename T> struct B
{
static A <sizeof (T), 0> x;
};
template <typename T>
A <sizeof (T), 0> B <T>::x;