This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]