This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Constructor is private within this context for gcc 3.0.3
- From: "Claudio Bley" <bley at cs dot uni-magdeburg dot de>
- To: Jacek Sokulski <jacek at lefthand dot com dot pl>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 29 Jan 2002 13:23:32 +0100
- Subject: Re: Constructor is private within this context for gcc 3.0.3
- References: <02Jan29.123859cet.115201@fullmoon.ensi.net>
>>>>> "Jacek" == Jacek Sokulski <jacek@lefthand.com.pl> writes:
Jacek> I encountered a problem with private constructors in the
Jacek> following code: class Input {
Jacek> public:
Jacek> explicit Input() {}; Input(const char* Id) {}; void
Jacek> test(const Input& xs){} private: Input(const Input&); };
Jacek> int main() { Input input; input.test(input);// This is OK.
Jacek> input.test("abc"); // Here we have the problem! return 0;
Jacek> }
Jacek> Previous version (2.96) of gcc compiles it without problems
Jacek> but 3.0.3 outputs the error message:
Jacek> test_gcc.cc: In function `int main()': test_gcc.cc:11:
Jacek> `Input::Input(const Input&)' is private test_gcc.cc:18:
Jacek> within this context test_gcc.cc:18: initializing argument 1
Jacek> of `void Input::test(const Input&)' from result of
Jacek> `Input::Input(const char*)'
Jacek> Can anyone help me? Jacek
Sorry, I can't help you here. I can only say your code compiles fine
for me with gcc v3.0.3.
Claudio