diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2014-05-14 20:56:04 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2014-05-14 20:56:04 +0000 |
commit | 014397c22e3a682f24b4d0e69ce2d336412b7264 (patch) | |
tree | 191dc471b8036ec4c2b7f7df0484c89e1646827c | |
parent | d40aeed84da43a8839e7ee1ce135f68a2b5a7003 (diff) | |
download | gcc-014397c22e3a682f24b4d0e69ce2d336412b7264.zip gcc-014397c22e3a682f24b4d0e69ce2d336412b7264.tar.gz gcc-014397c22e3a682f24b4d0e69ce2d336412b7264.tar.bz2 |
cp-tree.h (DIRECT_LIST_INIT_P): Add.
2014-05-14 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (DIRECT_LIST_INIT_P): Add.
* call.c (convert_like_real, build_new_method_call_1): Use it.
* decl2.c (grokfield): Likewise.
* init.c (perform_member_init, build_aggr_init, expand_default_init,
build_new_1): Likewise.
* mangle.c (write_expression): Likewise.
* parser.c (cp_parser_late_parse_one_default_arg): Likewise.
From-SVN: r210438
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/call.c | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 3 | ||||
-rw-r--r-- | gcc/cp/init.c | 12 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 3 |
7 files changed, 22 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b24a7c1..d60f6b3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2014-05-14 Paolo Carlini <paolo.carlini@oracle.com> + + * cp-tree.h (DIRECT_LIST_INIT_P): Add. + * call.c (convert_like_real, build_new_method_call_1): Use it. + * decl2.c (grokfield): Likewise. + * init.c (perform_member_init, build_aggr_init, expand_default_init, + build_new_1): Likewise. + * mangle.c (write_expression): Likewise. + * parser.c (cp_parser_late_parse_one_default_arg): Likewise. + 2014-05-14 Jason Merrill <jason@redhat.com> PR c++/20332 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 23fad8f..1b8c38c 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6119,8 +6119,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, constructors, but actually trying to call one is an error. */ if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn) /* Unless this is for direct-list-initialization. */ - && !(BRACE_ENCLOSED_INITIALIZER_P (expr) - && CONSTRUCTOR_IS_DIRECT_INIT (expr))) + && !DIRECT_LIST_INIT_P (expr)) { if (!(complain & tf_error)) return error_mark_node; @@ -7859,8 +7858,7 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args, /* If CONSTRUCTOR_IS_DIRECT_INIT is set, this was a T{ } form initializer, not T({ }). */ if (DECL_CONSTRUCTOR_P (fn) && args != NULL && !vec_safe_is_empty (*args) - && BRACE_ENCLOSED_INITIALIZER_P ((**args)[0]) - && CONSTRUCTOR_IS_DIRECT_INIT ((**args)[0])) + && DIRECT_LIST_INIT_P ((**args)[0])) { tree init_list = (**args)[0]; tree init = NULL_TREE; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f3788a7..3bd2e8c 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3437,6 +3437,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) B b{1,2}, not B b({1,2}) or B b = {1,2}. */ #define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE))) +#define DIRECT_LIST_INIT_P(NODE) \ + (BRACE_ENCLOSED_INITIALIZER_P (NODE) && CONSTRUCTOR_IS_DIRECT_INIT (NODE)) + /* True if NODE represents a conversion for direct-initialization in a template. Set by perform_implicit_conversion_flags. */ #define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7140218..b18f65a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -983,8 +983,7 @@ grokfield (const cp_declarator *declarator, if (attrlist) cplus_decl_attributes (&value, attrlist, 0); - if (init && BRACE_ENCLOSED_INITIALIZER_P (init) - && CONSTRUCTOR_IS_DIRECT_INIT (init)) + if (init && DIRECT_LIST_INIT_P (init)) flags = LOOKUP_NORMAL; else flags = LOOKUP_IMPLICIT; diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 6838d2a..80764f9 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -642,8 +642,7 @@ perform_member_init (tree member, tree init) && TREE_TYPE (init) == type) /* { } mem-initializer. */ || (TREE_CODE (init) == TREE_LIST - && TREE_CODE (TREE_VALUE (init)) == CONSTRUCTOR - && CONSTRUCTOR_IS_DIRECT_INIT (TREE_VALUE (init)))) + && DIRECT_LIST_INIT_P (TREE_VALUE (init)))) && (CP_AGGREGATE_TYPE_P (type) || is_std_init_list (type))))) { @@ -1515,8 +1514,7 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain) && TREE_CODE (init) != TREE_LIST && !(TREE_CODE (init) == TARGET_EXPR && TARGET_EXPR_DIRECT_INIT_P (init)) - && !(BRACE_ENCLOSED_INITIALIZER_P (init) - && CONSTRUCTOR_IS_DIRECT_INIT (init))) + && !DIRECT_LIST_INIT_P (init)) flags |= LOOKUP_ONLYCONVERTING; if (TREE_CODE (type) == ARRAY_TYPE) @@ -1589,8 +1587,7 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags, /* If we have direct-initialization from an initializer list, pull it out of the TREE_LIST so the code below can see it. */ if (init && TREE_CODE (init) == TREE_LIST - && BRACE_ENCLOSED_INITIALIZER_P (TREE_VALUE (init)) - && CONSTRUCTOR_IS_DIRECT_INIT (TREE_VALUE (init))) + && DIRECT_LIST_INIT_P (TREE_VALUE (init))) { gcc_checking_assert ((flags & LOOKUP_ONLYCONVERTING) == 0 && TREE_CHAIN (init) == NULL_TREE); @@ -2791,8 +2788,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts, { tree vecinit = NULL_TREE; if (vec_safe_length (*init) == 1 - && BRACE_ENCLOSED_INITIALIZER_P ((**init)[0]) - && CONSTRUCTOR_IS_DIRECT_INIT ((**init)[0])) + && DIRECT_LIST_INIT_P ((**init)[0])) { vecinit = (**init)[0]; if (CONSTRUCTOR_NELTS (vecinit) == 0) diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 97fb4c6..34a0c95 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2806,8 +2806,7 @@ write_expression (tree expr) write_type (type); if (init && TREE_CODE (init) == TREE_LIST - && TREE_CODE (TREE_VALUE (init)) == CONSTRUCTOR - && CONSTRUCTOR_IS_DIRECT_INIT (TREE_VALUE (init))) + && DIRECT_LIST_INIT_P (TREE_VALUE (init))) write_expression (TREE_VALUE (init)); else { diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5542dcd..dae4393 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -23674,8 +23674,7 @@ cp_parser_late_parse_one_default_arg (cp_parser *parser, tree decl, else { int flags = LOOKUP_IMPLICIT; - if (BRACE_ENCLOSED_INITIALIZER_P (parsed_arg) - && CONSTRUCTOR_IS_DIRECT_INIT (parsed_arg)) + if (DIRECT_LIST_INIT_P (parsed_arg)) flags = LOOKUP_NORMAL; parsed_arg = digest_init_flags (TREE_TYPE (decl), parsed_arg, flags); if (TREE_CODE (parsed_arg) == TARGET_EXPR) |