This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36393] New: Copy constructor not used but required
- From: "peter dot klotz at aon dot at" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 May 2008 19:29:59 -0000
- Subject: [Bug c++/36393] New: Copy constructor not used but required
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code compiles with gcc 3.2.3 and the current Comeau compiler.
However it fails with gcc 4.1.2 and gcc 4.2.3.
class A
{
public:
A(bool) {};
private:
A(const A&);
};
class B
{
public:
B(const A&) {};
};
int main(void)
{
B b(A(true));
return 0;
}
Gives this error message:
test.cpp: In function ?int main()?:
test.cpp:6: error: ?A::A(const A&)? is private
test.cpp:17: error: within this context
I don't see where the code above would need a copy constructor for class A.
Making the copy constructor of A public without implementing it makes the code
compile.
--
Summary: Copy constructor not used but required
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peter dot klotz at aon dot at
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36393