[RFC / Patch] C++/26099 or front-end support to type traits

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Tue Mar 13 16:19:00 GMT 2007

>> For the syntax, I'd prefer something like
>> __trait__<__has_trivial_constructor__> (x) which reminds attributes
>> (but with a C++ touch on it!) or, alternatively,
>> __trait__<x> (__has_trivial_constructor__).  It also does not
>> require the proliferation of keywords in the scanner since you
>> can parse an arbitrary identifier and compare it with strcmp.
> Well, there is a problem that it would be the first time we usr this
> kinf of syntax, which also doesn't match the Intel version of these
> builtins (I took that and added a __gnu_* in front as Mark recommended
> time ago):

I see.  With the added "__gnu_", however, the syntax is still
incompatible; my proposal can be mapped to the Intel syntax using

#define __has_copy(x)  __trait__<x>(__has_copy__)

or something like that; and I guess I should have spelled it
__gnu_trait__.  If adding one keyword only means that we can
remove the "gnu", however, IMHO this would be a point in favor of
my proposal.

But it's your and the C++ maintainers' call, obviously.


More information about the Gcc-patches mailing list