This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: strange warning 'control reaches end of non-void function'
- To: peter dot kelb at mchp dot siemens dot de
- Subject: Re: strange warning 'control reaches end of non-void function'
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 10 Mar 2000 11:40:49 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <38C8C41C.6FF85F60@mchp.siemens.de>
> I get a strange warning in the following case:
Thanks for your bug report. This is a known problem, and already
recorded in
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=58&database=gcc
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=22&database=gcc
whose priority I just increased.
> Can you help.
If you want to avoid the warning, you have to rephrase it as
A* create() {
vector<A> arNewArgs;
A* a = new A();
return a;
}
If you are worried about the compiler generating bad code: it is
not. The warning comes from the implicit delete that occurs when the
constructor of A throws an exception.
If that is not the kind of help you were looking for, and if you were
not expecting an immediate bugfix, either, please let us know what
help you need.
Regards,
Martin