PR c++/58162
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Oct 2013 14:41:55 +0000 (14:41 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Oct 2013 14:41:55 +0000 (14:41 +0000)
* parser.c (cp_parser_late_parse_one_default_arg): Set
TARGET_EXPR_DIRECT_INIT_P.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204263 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/nsdmi9.C [new file with mode: 0644]

index a0d802f..3410153 100644 (file)
@@ -1,5 +1,9 @@
 2013-10-31  Jason Merrill  <jason@redhat.com>
 
+       PR c++/58162
+       * parser.c (cp_parser_late_parse_one_default_arg): Set
+       TARGET_EXPR_DIRECT_INIT_P.
+
        * class.c (type_build_ctor_call): Return early in C++98 mode.
        (type_build_dtor_call): Likewise.
 
index 9e28ced..bbc8e75 100644 (file)
@@ -23212,6 +23212,9 @@ cp_parser_late_parse_one_default_arg (cp_parser *parser, tree decl,
              && CONSTRUCTOR_IS_DIRECT_INIT (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;
        }
     }
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi9.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi9.C
new file mode 100644 (file)
index 0000000..febe0ec
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/58162
+// { dg-require-effective-target c++11 }
+
+struct A {
+ A();
+ A(A&&);
+};
+
+struct B {
+ A const a = A();
+};
+
+B b;