This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Constructor is private within this context for gcc 3.0.3
- From: Jacek Sokulski <jacek at lefthand dot com dot pl>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 29 Jan 2002 12:41:42 +0100
- Subject: Constructor is private within this context for gcc 3.0.3
- Organization: LeftHand
I encountered a problem with private constructors in the following code:
class Input
{
public:
explicit
Input() {};
Input(const char* Id) {};
void test(const Input& xs){}
private:
Input(const Input&);
};
int
main()
{
Input input;
input.test(input);// This is OK.
input.test("abc"); // Here we have the problem!
return 0;
}
Previous version (2.96) of gcc compiles it without problems but 3.0.3
outputs the error message:
test_gcc.cc: In function `int main()':
test_gcc.cc:11: `Input::Input(const Input&)' is private
test_gcc.cc:18: within this context
test_gcc.cc:18: initializing argument 1 of `void Input::test(const
Input&)'
from result of `Input::Input(const char*)'
Can anyone help me?
Jacek