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]

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



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



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