https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69549
--- Comment #5 from Thiago Macieira <thiago at kde dot org> ---
BTW, Clang solved this by making __seg_fs, __seg_gs macros that resolve to
__attribute__:
$ clang -dM -E -xc /dev/null | grep __seg_.s
#define __seg_fs __attribute__((address_space(257)))
#define __seg_gs __attribute__((address_space(256)))
That way, they don't need to be deduced as qualifiers in C, like const,
volatile and _Atomic.
So this compiles with Clang in C++:
void *tid() { auto tib = (void * __seg_fs*)(0); return *tid; }
_Z3tibv: # @_Z3tibv
movq %fs:0, %rax
retq