This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65291] protected using constructor default arguments not recognized
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Mar 2015 10:08:48 +0000
- Subject: [Bug c++/65291] protected using constructor default arguments not recognized
- Auto-submitted: auto-generated
- References: <bug-65291-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65291
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Do you really need to attach a tarball with four separate files to demonstrate
this?! It just makes it a pain to inspect the code.
Here's the complete source:
class A {
public:
A(int a = 0) { }
};
class B : public A {
public:
B(int b1, int b2) : A(b1) {}
protected:
using A::A;
};
class C : public B {
C() : B() {}
};
int main() {
B b(1,2);
C c;
}
The C++ standard says that B inherits a constructor taking a single int, the
default argument is not inherited, so B has no default constructor, and G++ is
correct to reject the program.