https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65471
Bug ID: 65471 Summary: type interpretation in _Generic Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jens.gustedt at inria dot fr This is a bug marker for an underspecification in the C11 standard, that has been observed in DR#423 http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_423 gcc and clang went quite opposite ways to resolve that issue, resulting in severe incompatibility for _Generic expression that use qualifiers or arrays. The following six lines illustrate the problem char const* a = _Generic("bla", char*: "blu"); // clang error char const* b = _Generic("bla", char[4]: "blu"); // gcc error char const* c = _Generic((int const){ 0 }, int: "blu"); // clang error char const* d = _Generic((int const){ 0 }, int const: "blu"); // gcc error char const* e = _Generic(+(int const){ 0 }, int: "blu"); // both ok char const* f = _Generic(+(int const){ 0 }, int const: "blu"); // both error the last two lines, where gcc and clang agree, points to the nature of the problem: gcc treats all such expressions as rvalues, clang as lvalues.