public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Constructor is private within this context for gcc 3.0.3
@ 2002-01-29  3:35 Jacek Sokulski
  2002-01-29  4:23 ` Claudio Bley
  2002-01-29  8:50 ` sumesh
  0 siblings, 2 replies; 3+ messages in thread
From: Jacek Sokulski @ 2002-01-29  3:35 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-29 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-29  3:35 Constructor is private within this context for gcc 3.0.3 Jacek Sokulski
2002-01-29  4:23 ` Claudio Bley
2002-01-29  8:50 ` sumesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).