From 5d4fffb822d1370d3e8efb694dbc9dc35d003de8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 9 Oct 2014 14:05:23 -0400 Subject: [PATCH] =?utf8?q?re=20PR=20c++/63415=20(internal=20compiler=20err?= =?utf8?q?or:=20unexpected=20expression=20=E2=80=98static=5Fcast(std:?= =?utf8?q?:is=5Fsame{})=E2=80=99=20of=20kind=20static=5Fcast=5Fex?= =?utf8?q?pr)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR c++/63415 * pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type. (iterative_hash_template_arg): Likewise. From-SVN: r216043 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 3 +++ gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C | 7 +++++++ 3 files changed, 14 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C 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{}); +}; -- 2.30.2