Bug 62310 - fails to consider default initializers (NSDMIs) when checking inheriting constructors
Summary: fails to consider default initializers (NSDMIs) when checking inheriting cons...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 7.2
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2014-08-29 21:51 UTC by Richard Smith
Modified: 2021-08-04 20:46 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 10.1.0, 7.2.0, 7.5.0, 8.1.0, 9.1.0
Known to fail: 4.8.2, 4.9.1, 5.0, 6.4.0, 7.1.0
Last reconfirmed: 2014-12-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Smith 2014-08-29 21:51:02 UTC
Consider:

struct A { A(int); A() = delete; };
struct B { B(int); B() = delete; };
struct C : B { using B::B; A a = 0; } c(0);

GCC rejects this valid code:

<stdin>:1:114: error: use of deleted function ‘C::C(int)’
<stdin>:1:97: note: ‘C::C(int)’ is implicitly deleted because the default definition would be ill-formed:
<stdin>:1:97: error: use of deleted function ‘A::A()’
<stdin>:1:20: note: declared here

However, if you remove the '= delete' from A, GCC does in fact call A::A(int), so this seems to be limited to determining if the inheriting constructor should be deleted.
Comment 1 Paul Pluzhnikov 2014-08-30 00:35:43 UTC
Google ref: b/17333074
Comment 2 Andrew Pinski 2021-08-04 20:46:01 UTC
Fixed in GCC 7.2.0 and 8+.