diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-21 06:14:51 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-21 06:14:51 +0000 |
commit | 75e7d66079cd68e5d75147d0c60f2d16f3d09c58 (patch) | |
tree | 11519c963c3d490eac35dda5e5b2dad24fe8e063 /gcc/cp | |
parent | 056367c50378efb136c7547b768d2a85d7198c10 (diff) | |
download | gcc-75e7d66079cd68e5d75147d0c60f2d16f3d09c58.tar.gz |
PR c++/70824 - initializer_list in template
* init.c (constant_value_1): Don't instantiated DECL_INITIAL of
artificial variables.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@238565 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/init.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7b6cad89371..a674793398f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-07-21 Jason Merrill <jason@redhat.com> + PR c++/70824 + * init.c (constant_value_1): Don't instantiated DECL_INITIAL of + artificial variables. + * lambda.c (maybe_add_lambda_conv_op): Fix null object argument. 2016-07-20 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 5e2393b788e..75e56f17e00 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2072,8 +2072,13 @@ constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p) && TREE_CODE (init) == TREE_LIST && TREE_CHAIN (init) == NULL_TREE) init = TREE_VALUE (init); - /* Instantiate a non-dependent initializer. */ - init = instantiate_non_dependent_or_null (init); + /* Instantiate a non-dependent initializer for user variables. We + mustn't do this for the temporary for an array compound literal; + trying to instatiate the initializer will keep creating new + temporaries until we crash. Probably it's not useful to do it for + other artificial variables, either. */ + if (!DECL_ARTIFICIAL (decl)) + init = instantiate_non_dependent_or_null (init); if (!init || !TREE_TYPE (init) || !TREE_CONSTANT (init) |