strange warning 'control reaches end of non-void function'

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri Mar 10 02:43:00 GMT 2000


> 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



More information about the Gcc-bugs mailing list