This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch/RFC] PR 58753 & 58930


On 05/20/2014 10:50 AM, Paolo Carlini wrote:
+      if (TREE_TYPE (init) != type)
+	{
+	  if (BRACE_ENCLOSED_INITIALIZER_P (init)
+	      && CP_AGGREGATE_TYPE_P (type))
+	    init = reshape_init (type, init, tf_warning_or_error);
+	  init = digest_init (type, init, tf_warning_or_error);

Instead of this let's factor the relevant code out of cp_parser_late_parse_one_default_arg and use it here as well. That is,

          int flags = LOOKUP_IMPLICIT;
          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)
            /* This represents the whole initialization.  */
            TARGET_EXPR_DIRECT_INIT_P (parsed_arg) = true;

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]