From: Leonid Koppel Date: Wed, 26 Jul 2017 17:39:26 +0000 (+0000) Subject: PR c++/67054 - Inherited ctor with non-default-constructible members X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80e7cb2d6b46db10b739d7c311524975721596ba;p=gcc.git PR c++/67054 - Inherited ctor with non-default-constructible members PR c++/67054 - Inherited ctor with non-default-constructible members * method.c (walk_field_subobs) Consider member initializers (NSDMIs) when deducing an inheriting constructor. From-SVN: r250583 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d65dc55f682..b2df1eff896 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-07-26 Leonid Koppel + + PR c++/67054 - Inherited ctor with non-default-constructible members + * method.c (walk_field_subobs) Consider member initializers (NSDMIs) + when deducing an inheriting constructor. + 2017-07-21 Nathan Sidwell * search.c (lookup_conversion_operator): Return overloads. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index cca1b146917..8b07f526473 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1342,7 +1342,7 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk, if (bad && deleted_p) *deleted_p = true; } - else if (sfk == sfk_constructor) + else if (sfk == sfk_constructor || sfk == sfk_inheriting_constructor) { bool bad; diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C new file mode 100644 index 00000000000..8e31f739d74 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C @@ -0,0 +1,23 @@ +// PR c++/67054 +// { dg-do compile { target c++11 } } + +struct A +{ + A(int) {} +}; + +struct C +{ + C(int) {} +}; + +struct B : A +{ + using A::A; + C c = 42; +}; + +int main() +{ + B b = 24; +}