This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Constructor is private within this context for gcc 3.0.3


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]