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]

Bug/feature request for initialisation warnings


Hi,

Consider the following:

class F
{
public:
	void foo(char c);
	static void bar(char c);
};

int
main()
{
	F	f;

	char c = 23.23;		// warning

	c = 9435.23;		// warning
	
	F::bar(23.23);		// no warning

	f.foo(23.23);		// no warning
}


The last two function calls do not elicit a warning from the compiler
even though the initialisation of the argument c in foo and bar is
equivalent to the initialisation of the auto variable c in main().
A warning should be printed in all cases.

Please CC me on any replies.

Regards,

Niall


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