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

--- Comment #6 from Petr Skocik <pskocik at gmail dot com> ---
(In reply to Petr Skocik from comment #5)
> (In reply to Andrew Pinski from comment #4)
> > Invalid as mentioned in r13-3135-gfa258f6894801a .
> 
> I believe it's still a bug for pre-c2x __typeof.
> While it is GCC's prerogative to include _Noreturn/__attribute((noreturn))
> into the type for its own __typeof (which, BTW, I think is better design
> than the standardized semantics), I think two otherwise compatible function
> types should still remain compatible if they both either have or don't have
> _Noreturn/__attribute((noreturn)). But treating `_Noreturn void
> NR_FN_A(void);` 
> as INcompatible with `_Noreturn void NR_FN_B(void);` that's just wonky, IMO.

OK, the bug was MINE after all.

For bug report archeologists: I was doing what was meant to be a full
(qualifers-including) type comparison wrong. While something like
_Generic((__typeof(type0)*)0, __typeof(type1)*:1, default:0) suffices to get
around _Generic dropping qualifs (const/volatile/_Atomic) in its controlling
expression, for function pointer types at single pointer layer of indirection,
the _Noreturn attribute will still get dropped in the controlling expression of
_Generic (I guess that makes sense because they're much more closely related to
functions that how another pointer type would be related to its target type)
and another pointer layer of indirection if required as in
`_Generic((__typeof(type0)**)0, __typeof(type1)**:1, default:0)`.

Thanks you all very much, especially jos...@codesourcery.com, who pointed me
(pun intended) to the right solution over email. :)

Reply via email to