On 12 May 2012 19:34, Paolo Carlini <paolo.carl...@oracle.com> wrote: > Hi, > > the below is my (very conservative, I think) interpretation of what we > recently summarized we want to do wrt these -Wconversion warnings in the > conditional expressions context. Of course many details could be different, > please let me know... This is booted and tested on x86_64-linux. > > Thanks, > Paolo.
It seems very conservative also to me. I think the code should just unconditionally recurse on the operands of COND_EXPR. The recursion should then take care of the casts. So then c = b ? c : i; will warn about 'i', not about the whole conditional expression. Did you find any issues with doing: + STRIP_USELESS_TYPE_CONVERSION (expr); + /* Don't warn about unsigned char y = 0xff, x = (int) y; */ + expr = get_unwidened (expr, 0); + expr_type = TREE_TYPE (expr); just before the switch? (and deleting the get_unwidened quite a few lines below) Cheers, Manuel.