public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* -Wconversion is very poor
@ 2011-03-23 18:37 Lisp2D
  2011-03-23 18:45 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Lisp2D @ 2011-03-23 18:37 UTC (permalink / raw)
  To: gcc


I've turned on all warnings to have clean program. 
Turn on -Wconversion but it will not care about BIG trouble in C++:
conversion.

class A{
public:
A(unsigned	int){}
};

class B{
public:
B(A){}
};

B b(-1); //OK without warnings
int	main(void){}

----
-1 => A(FF..FF) => B(FF..FF)
I want to see all program like:

B b(A(-1));

Which warning I must to set?

-- 
View this message in context: http://old.nabble.com/-Wconversion-is-very-poor-tp31222297p31222297.html
Sent from the gcc - Dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: -Wconversion is very poor
  2011-03-23 18:37 -Wconversion is very poor Lisp2D
@ 2011-03-23 18:45 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2011-03-23 18:45 UTC (permalink / raw)
  To: Lisp2D; +Cc: gcc

On 23 March 2011 17:58, Lisp2D wrote:
>
> I've turned on all warnings to have clean program.
> Turn on -Wconversion but it will not care about BIG trouble in C++:
> conversion.
>
> class A{
> public:
> A(unsigned      int){}
> };
>
> class B{
> public:
> B(A){}
> };
>
> B b(-1); //OK without warnings
> int     main(void){}
>
> ----
> -1 => A(FF..FF) => B(FF..FF)
> I want to see all program like:
>
> B b(A(-1));
>
> Which warning I must to set?

Your question is inappropriate for this mailing list, questions about
using or building gcc should go to gcc-help@gcc.gnu.org

Please take any follow up question to that list, thanks.

As clearly documented in the manual, you need -Wsign-conversion in C++
http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Warning-Options.html#index-Wconversion-368

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-23 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23 18:37 -Wconversion is very poor Lisp2D
2011-03-23 18:45 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).