https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101030
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[9/10/11/12 Regression] gcc |[9/10/11/12 Regression] ICE |internal error with |with -Wconversion and a?:b |Wconversion |extension in template | |argument --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Simple fix but I doubt it is the correct fix: diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index 84ad6633c96..ddaf0036abc 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -1296,8 +1296,10 @@ conversion_warning (location_t loc, tree type, tree expr, tree result) case COND_EXPR: { /* In case of COND_EXPR, we do not care about the type of - COND_EXPR, only about the conversion of each operand. */ - tree op1 = TREE_OPERAND (expr, 1); + COND_EXPR, only about the conversion of each operand + except if we had a?:b then we care about the original + expression. */ + tree op1 = TREE_OPERAND (expr, 1) ? TREE_OPERAND (expr, 1) : TREE_OPERAND (expr, 0); tree op2 = TREE_OPERAND (expr, 2); return (conversion_warning (loc, type, op1, result)