cp-tree.h (DIRECT_LIST_INIT_P): Add.
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 14 May 2014 20:56:04 +0000 (20:56 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 14 May 2014 20:56:04 +0000 (20:56 +0000)
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

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/cp/init.c
gcc/cp/mangle.c
gcc/cp/parser.c

index b24a7c1..d60f6b3 100644 (file)
@@ -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
index 23fad8f..1b8c38c 100644 (file)
@@ -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;
index f3788a7..3bd2e8c 100644 (file)
@@ -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) \
index 7140218..b18f65a 100644 (file)
@@ -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;
index 6838d2a..80764f9 100644 (file)
@@ -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)
index 97fb4c6..34a0c95 100644 (file)
@@ -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
        {
index 5542dcd..dae4393 100644 (file)
@@ -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)