980608 value returning inlines not checked

David C Binderman dcb@pncl.co.uk
Wed Jun 10 13:20:00 GMT 1998


Hello there,

For the following source code, compiled by egcs-980608 on
Linux/i586

int i = 1;

inline double
f1()
{
	i = 2;
	// note no return stmt.
}

struct A {};

inline A
f2()
{
	i = 3;
	// note no return stmt.
}

struct B {
	int foo() {
		i = 4;
		// note no return stmt.
	}
};

struct C {
	C foo() {
		i = 5;
		// note no return stmt.
	}
};

struct D {
	inline D foo();
};

inline D
D::foo()
{
	i = 6;
	// note no return stmt.
}

int
main()
{
	f1();
	f2();

	B b;
	b.foo();

	C c;
	c.foo();

	D d;
	d.foo();

	return 0;
}

I got *no* errors at compile time. Other compiler happily spot the many
problems in the
code.

Regards

David Binderman MSc BSc    +44 1293 534 847       dcb_AVOID_JUNK_MAIL@pncl.co.uk
There is no substitute for skill, taste and experience when programming
 - Dr Stroustrup, inventor of C++




More information about the Gcc-bugs mailing list