On Mon, Jan 13, 2020 at 02:59:54PM +0000, Will Deacon wrote: > // Insert big fat comment here > #define unqual_typeof(x) typeof(({_Atomic typeof(x) ___x __maybe_unused; ___x; })) > > That apparently *requires* GCC 4.8, but I think the question is more about > whether it's easier to stomach the funny use of _Atomic or the nested > __builtin_choose_expr() I have here. I'm also worried about how reliable > the _Atomic thing is, or whether it's just an artifact of how GCC happens > to work today. As far as I understand it, it's an artifact of how GCC works today (it was added to support the type-generic macros in <tgmath.h>). I also think it's also quite fragile, for example, the unqualified type is returned if typeof's argument is an expression but not if it's a 'typename'. IOW: typeof(_Atomic typeof(const int)) returns 'const int', while typeof(({_Atomic typeof(const int) x; x; })) returns 'int'. -- Luc