-pedantic-errors, ? : and ptrs to base classes

David C Binderman dcb@pncl.co.uk
Wed Sep 2 11:38:00 GMT 1998


Hello there,

// I think this code should compile.

// On Linux / Alpha egcs-980824 with no flags it does.
// However, when I use flags -ansi -pedantic-errors, it does not.
//
// I think there is nothing wrong with the code,
// and so an error should not be produced.

struct B {};
struct D1 : public B {};
struct D2 : public B {};

B *
f( int i, D1 * pD1, D2 * pD2)
{
	return i ? pD1 : pD2;
};

Regards
David C Binderman MSc BSc	+44 1293 534847		dcb@pncl.co.uk




More information about the Gcc-bugs mailing list