https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114731

uecker at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uecker at gcc dot gnu.org

--- Comment #13 from uecker at gcc dot gnu.org ---
A couple of comments:

In principle, those warnings are not false positives. The design of _Generic
requires that the non-taken branches are valid in C, so some warnings are
required by the C standard.  We can tweak warnings (which we already did for
some), but I do not think it is possible to solve all issues in this wa.

There are different ways to work around this:

One can work around using explicit casts and/or temporary values so that the
code of all branches is always valid. 

It may be helpful to flatten multi-level _Generic to one level by matching an
artificial function pointer type:

#define foo(a, b) _Generic((void(*)(typeof(a), typeof(b)))0, void(*)(int, int):
...)


In my opinion, and extension such as 

_Generic(x, int i: ... i ...);

where i then has type int inside the branch would be useful.

Reply via email to