This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: gcc 3.0 and C++
- To: "Bohdan Vlasyuk" <bohdan at kivc dot vstu dot vinnica dot ua>
- Subject: RE: gcc 3.0 and C++
- From: "Rob Taylor" <robt at flyingpig dot com>
- Date: Fri, 20 Jul 2001 11:13:32 +0100
- Cc: "Gcc at Gcc dot Gnu. Org" <gcc at gcc dot gnu dot org>
looks like your trying to pass a temporary into a non-const reference. thats a
BAD THING. modify the constructor of Language to take a const reference or use
pass-by-copy.
Rob
> I have strange feeling that it's a kind of `something wrong' with
> gcc. Trying to compile my program on gcc 3.0, have this error:
>
> language.cpp: In constructor `LangList::LangList()':
> language.cpp:285: no matching function for call to `Data::Data(Data)'
> data.h:13: candidates are: Data::Data(Data&)
> data.h:11: Data::Data(char*)
> data.h:10: Data::Data(long int)
> language.cpp:285: initializing argument 1 of
> `Language::Language(Data)' from
> result of `Data::Data(char*)'
>
> relevant lines:
>
> if(S_ISREG(statistics.st_mode)) {
> Language * newlang = new
> Language(directory->d_name);
> directory->d_name is char*
>
> Language has only one constructor:
>
> Language(Data);
>
>
> Data is a kind of universal malloc'ed type, that'd be used [in future
> version :-)] for garbage collection. It can be constructed with:
>
> Data(long new_size);
> Data(char*s);
> Data();
> Data(Data& new_d);
>
>
> I don't understand, why can't Language(char*) just make it
> Language(Data(char*)), and why does it complain..
>
> I'm sorry if that's not actually bug, and I admit I'm not very good in
> C++.
>
> P.s.: I could send actual preprocessed output, but I guess it'll wait
> until anyone would actually confirm it's bug.
>
> thanks!
>
> --
> You love peace.
>