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]

Re: Constructor is private within this context for gcc 3.0.3


>>>>> "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


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