]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58162 ([C++11] bogus error: use of deleted function 'constexpr A::A(const...
authorJason Merrill <jason@redhat.com>
Thu, 31 Oct 2013 14:41:55 +0000 (10:41 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 31 Oct 2013 14:41:55 +0000 (10:41 -0400)
PR c++/58162
* parser.c (cp_parser_late_parse_one_default_arg): Set
TARGET_EXPR_DIRECT_INIT_P.

From-SVN: r204263

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

index a0d802f1c3777884fbae596c65e0723df82d5b28..34101530cf95df98a9fbe851db9be518e3e79d56 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 9e28cedd0e7521d3dd7737a4ea3e3d67059f5086..bbc8e751a873294d1255ceb01fa2be4fd61226eb 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;