diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-12 08:45:46 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-12 08:45:46 +0000 |
commit | de7822787195e4b0af134a143fe6705a5c9a7772 (patch) | |
tree | dbd66f0fc4f46feb5cee99038d86d584ab82fee0 | |
parent | 312243bb4f5d8d31e26ebfc0d379afb621e82d43 (diff) | |
download | ppe42-gcc-de7822787195e4b0af134a143fe6705a5c9a7772.tar.gz ppe42-gcc-de7822787195e4b0af134a143fe6705a5c9a7772.zip |
/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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207712 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/method.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr60047.C | 14 |
4 files changed, 29 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6bb1115fad6..3d2c6b2261d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index b1fa943ce6c..78438245825 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4ec552b5e50..2505b6a5882 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 00000000000..ab73e752e95 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr60047.C @@ -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>(); |