]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60047 (ICE with defaulted copy constructor and virtual base class)
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 12 Feb 2014 08:45:46 +0000 (08:45 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 12 Feb 2014 08:45:46 +0000 (08:45 +0000)
/cp
2014-02-12  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/60047
* method.c (implicitly_declare_fn): A constructor of a class with
virtual base classes isn't constexpr (7.1.5p4).

/testsuite
2014-02-12  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/60047
* g++.dg/cpp0x/pr60047.C: New.

From-SVN: r207712

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

index 6bb1115fad604fde4ce5f13d0cb00ec7f9cef64b..3d2c6b2261d097db3851e31f1245e666c6c6b689 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-12  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/60047
+       * method.c (implicitly_declare_fn): A constructor of a class with
+       virtual base classes isn't constexpr (7.1.5p4).
+
 2014-02-05  Jan Hubicka  <hubicka@ucw.cz
 
        * parser.c (synthesize_implicit_template_parm): Use grow_tree_vec.
index b1fa943ce6c9d13bd5918d414d93c1e2810763ee..784382458252bec3e2b34f1d47d92df0e33074f7 100644 (file)
@@ -1656,10 +1656,12 @@ implicitly_declare_fn (special_function_kind kind, tree type,
   /* Don't bother marking a deleted constructor as constexpr.  */
   if (deleted_p)
     constexpr_p = false;
-  /* A trivial copy/move constructor is also a constexpr constructor.  */
+  /* A trivial copy/move constructor is also a constexpr constructor,
+     unless the class has virtual bases (7.1.5p4).  */
   else if (trivial_p && cxx_dialect >= cxx11
           && (kind == sfk_copy_constructor
-              || kind == sfk_move_constructor))
+              || kind == sfk_move_constructor)
+          && !CLASSTYPE_VBASECLASSES (type))
     gcc_assert (constexpr_p);
 
   if (!trivial_p && type_has_trivial_fn (type, kind))
index 4ec552b5e50a0bf8517916e1e54f67e42ebda667..2505b6a588223df238ec1f8e5522018303129b59 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-12  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/60047
+       * g++.dg/cpp0x/pr60047.C: New.
+
 2014-02-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/60101
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr60047.C b/gcc/testsuite/g++.dg/cpp0x/pr60047.C
new file mode 100644 (file)
index 0000000..ab73e75
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/60047
+// { dg-do compile { target c++11 } }
+
+struct B { };
+
+template<typename T> struct A : virtual B
+{
+  A();
+  A(const A&);
+};
+
+template<typename T> A<T>::A(const A<T>&) = default;
+
+A<int> a = A<int>();