public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fchelnokov at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104418] Error inheriting base class constructors by using-declaration Date: Mon, 07 Feb 2022 21:24:59 +0000 [thread overview] Message-ID: <bug-104418-4-PUG1bj14JG@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104418-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104418 --- Comment #4 from Fedor Chelnokov <fchelnokov at gmail dot com> --- I think `using B::B;` is not the same as redefining each constructor with the explicit call of base class constructor `C(int a) : B{(int)a}{}`. Please consider this example proving it: ``` struct A { A() {} A(const A&) = delete; }; struct B { B(A) {} }; // ok everywhere struct C : B { using B::B; }; //error everywhere struct D : B { D(A a) : B(a) {} }; ``` Here struct C definition is fine, but struct D is ill-formed because it requires A to be copyable. Demo: https://gcc.godbolt.org/z/T7bhv9jeP
next prev parent reply other threads:[~2022-02-07 21:24 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-07 11:51 [Bug c++/104418] New: " fchelnokov at gmail dot com 2022-02-07 19:21 ` [Bug c++/104418] " pinskia at gcc dot gnu.org 2022-02-07 20:43 ` fchelnokov at gmail dot com 2022-02-07 21:05 ` pinskia at gcc dot gnu.org 2022-02-07 21:24 ` fchelnokov at gmail dot com [this message] 2022-02-08 2:51 ` [Bug c++/104418] [C++14+] " pinskia at gcc dot gnu.org 2022-02-08 2:53 ` [Bug c++/104418] [C++17+] " pinskia at gcc dot gnu.org 2022-02-08 18:55 ` fchelnokov at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104418-4-PUG1bj14JG@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).