diff options
author | Jason Merrill <jason@redhat.com> | 2017-12-12 17:09:48 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-12-12 17:09:48 -0500 |
commit | 48f43f9547392ede42dbd56514d7386c564baa8d (patch) | |
tree | c68ad2ccc102595282b47894738c59ee589aa344 | |
parent | 5eb63cfd035391ed4a1552e41fa613c341fd7465 (diff) | |
download | gcc-48f43f9547392ede42dbd56514d7386c564baa8d.zip gcc-48f43f9547392ede42dbd56514d7386c564baa8d.tar.gz gcc-48f43f9547392ede42dbd56514d7386c564baa8d.tar.bz2 |
Remove type_dependent_init_p.
* decl.c (value_dependent_init_p): Check the type of a CONSTRUCTOR.
(type_dependent_init_p): Remove.
From-SVN: r255591
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/decl.c | 38 |
2 files changed, 7 insertions, 34 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 010f3f4..23dcc3f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-12-12 Jason Merrill <jason@redhat.com> + * decl.c (value_dependent_init_p): Check the type of a CONSTRUCTOR. + (type_dependent_init_p): Remove. + PR c++/82115 - ICE with variable initialized with its own address. * cp-tree.h (struct lang_decl_base): Add dependent_init_p. (DECL_DEPENDENT_INIT_P, SET_DECL_DEPENDENT_INIT_P): New. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3601fa1..445c23c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6644,38 +6644,6 @@ initialize_artificial_var (tree decl, vec<constructor_elt, va_gc> *v) } /* INIT is the initializer for a variable, as represented by the - parser. Returns true iff INIT is type-dependent. */ - -static bool -type_dependent_init_p (tree init) -{ - if (TREE_CODE (init) == TREE_LIST) - /* A parenthesized initializer, e.g.: int i (3, 2); ? */ - return any_type_dependent_elements_p (init); - else if (TREE_CODE (init) == CONSTRUCTOR) - /* A brace-enclosed initializer, e.g.: int i = { 3 }; ? */ - { - if (dependent_type_p (TREE_TYPE (init))) - return true; - - vec<constructor_elt, va_gc> *elts; - size_t nelts; - size_t i; - - elts = CONSTRUCTOR_ELTS (init); - nelts = vec_safe_length (elts); - for (i = 0; i < nelts; ++i) - if (type_dependent_init_p ((*elts)[i].value)) - return true; - } - else - /* It must be a simple expression, e.g., int i = 3; */ - return type_dependent_expression_p (init); - - return false; -} - -/* INIT is the initializer for a variable, as represented by the parser. Returns true iff INIT is value-dependent. */ static bool @@ -6687,6 +6655,9 @@ value_dependent_init_p (tree init) else if (TREE_CODE (init) == CONSTRUCTOR) /* A brace-enclosed initializer, e.g.: int i = { 3 }; ? */ { + if (dependent_type_p (TREE_TYPE (init))) + return true; + vec<constructor_elt, va_gc> *elts; size_t nelts; size_t i; @@ -6922,8 +6893,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, && init_const_expr_p && TREE_CODE (type) != REFERENCE_TYPE && decl_maybe_constant_var_p (decl) - && !(dep_init = (type_dependent_init_p (init) - || value_dependent_init_p (init)))) + && !(dep_init = value_dependent_init_p (init))) { /* This variable seems to be a non-dependent constant, so process its initializer. If check_initializer returns non-null the |