From: Jason Merrill Date: Thu, 9 Oct 2014 18:05:23 +0000 (-0400) Subject: re PR c++/63415 (internal compiler error: unexpected expression ‘static_cast(std::is_same{})’ of kind static_cast_expr) PR c++/63415 * pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type. (iterative_hash_template_arg): Likewise. From-SVN: r216043 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 744854855c6..09aad7db461 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-10-09 Jason Merrill + PR c++/63415 + * pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type. + (iterative_hash_template_arg): Likewise. + PR c++/63437 * cp-tree.h (REF_PARENTHESIZED_P): Also allow INDIRECT_REF. * semantics.c (force_paren_expr): And set it. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7d380e54b4a..85af59d7a5c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1598,6 +1598,7 @@ iterative_hash_template_arg (tree arg, hashval_t val) case CONSTRUCTOR: { tree field, value; + iterative_hash_template_arg (TREE_TYPE (arg), val); FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (arg), i, field, value) { val = iterative_hash_template_arg (field, val); @@ -21062,6 +21063,8 @@ value_dependent_expression_p (tree expression) { unsigned ix; tree val; + if (dependent_type_p (TREE_TYPE (expression))) + return true; FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expression), ix, val) if (value_dependent_expression_p (val)) return true; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C new file mode 100644 index 00000000000..3d859a8524d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C @@ -0,0 +1,7 @@ +// PR c++/63415 +// { dg-do compile { target c++11 } } + +template +struct A { + static constexpr int value = int(T{}); +};