From: jason Date: Thu, 9 Oct 2014 18:05:23 +0000 (+0000) Subject: PR c++/63415 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3be4750cb69598ff17cbcac1e38c617bcd78cc4a;p=thirdparty%2Fgcc.git PR c++/63415 * pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type. (iterative_hash_template_arg): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216043 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 744854855c66..09aad7db461b 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 7d380e54b4ac..85af59d7a5c4 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 000000000000..3d859a8524d9 --- /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{}); +};