public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104418] New: Error inheriting base class constructors by using-declaration
@ 2022-02-07 11:51 fchelnokov at gmail dot com
  2022-02-07 19:21 ` [Bug c++/104418] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fchelnokov at gmail dot com @ 2022-02-07 11:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104418

            Bug ID: 104418
           Summary: Error inheriting base class constructors by
                    using-declaration
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This code
```
struct B {
    B(int) {}
    B(int&&) {}
};

int i = 1;
B b(i); //ok everywhere

struct C : B {
    using B::B;
};

C c(i); //ok in Clang only
```
is accepted in Clang, but GCC complains:
```
<source>:13:6: error: use of deleted function 'C::C(int) [inherited from B]'
   13 | C c(i);
      |      ^
<source>:10:14: note: 'C::C(int) [inherited from B]' is implicitly deleted
because the default definition would be ill-formed:
   10 |     using B::B;
      |              ^
<source>:10:14: error: call of overloaded 'B(int)' is ambiguous
```
Demo: https://gcc.godbolt.org/z/79EoYM94d

Related question: https://stackoverflow.com/q/71005539/7325599

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-08 18:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 11:51 [Bug c++/104418] New: Error inheriting base class constructors by using-declaration 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
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

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).