* 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
* Re: Constructor is private within this context for gcc 3.0.3
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
1 sibling, 0 replies; 3+ messages in thread
From: Claudio Bley @ 2002-01-29 4:23 UTC (permalink / raw)
To: Jacek Sokulski; +Cc: gcc-help
>>>>> "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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Constructor is private within this context for gcc 3.0.3
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
1 sibling, 0 replies; 3+ messages in thread
From: sumesh @ 2002-01-29 8:50 UTC (permalink / raw)
To: gcc-help
Hi
Iam looking at the alias analysis done by GCC . Can any one tell me if
there is any option gcc has using which i can obtain the output of alias
analysis of a program .
Also any pointers on what kind of alias analysis does gcc use ,its
algorithm??
sumesh
----- Original Message -----
From: "Jacek Sokulski" <jacek@lefthand.com.pl>
To: <gcc-help@gcc.gnu.org>
Sent: Tuesday, January 29, 2002 6:41 AM
Subject: 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
>
>
^ 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).