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

Mark Mitchell mark@codesourcery.com
Tue Mar 13 23:27:00 GMT 2007

Paolo Carlini wrote:
> Andrew Pinski wrote:
>>> +
>>> +/* Represents a trait expression during template expansion. Operand 0
>>> +   is the kind of trait.  Operand 1 the queried type.  */
>>> +DEFTREECODE (TRAIT_EXPR, "trait_expr", tcc_expression, 2)
>> One suggestion is to make this tcc_exceptional and make a new
>> structure for the code, this will reduce memory usage.
> Yes, that would be easy, in fact I tested also a version using
> tcc_exceptional, attached.

I'm glad to see you working on this.

I agree that the first thing to do is nail down the syntax; details
about tree codes and such can come later.  (Certainly, tcc_exceptional
seems like the better of the two alternatives you posted; what exactly
to do about too many tree codes is something I want to think about
later, and respond to in the context of Doug's thread, not in this one.)

I think it would be better to use *exactly* the Microsoft syntax.  At
some point, someone is going to want Microsoft compatibility in this
respect, as they have in others.  In practice, it's not likely that the
C++ committee, or even another compiler vendor, is going to claim
__is_class for some other purpose.  They also meet Gaby's request for a
C-compatible syntax.

I think you're right that these have to be keywords, and I think your
implementation looks very sensible.


Mark Mitchell
(650) 331-3385 x713

More information about the Gcc-patches mailing list