[PATCH] [libcxx] Take advantage of gcc4.7 frontend support in type_traits

Albert Wong ajwong at google.com
Thu Jul 10 10:13:30 PDT 2014

Thanks Marshall!

I agree about the unfortunate weaving of GCC specific logic in type_traits and my first attempt locally went down the route of per-feature macro abstraction of __has_feature(). It became unwieldy rather quickly. Also the existing code had multiple patterns for feature checking. :(

With this patch, things should be normalized to (a) Use _GNU_VER and __cplusplus where possible (b) use a feature macro *if* the gcc and clang built-in are syntactically different (eg __is_literal() vs __is_literal_type()).

I personally think that directly using the gcc version check to gate which feature is used in type_traits is an "okay" tradeoff. An alternative is to simulate __has_feature() for gcc in __config. If you can tell me which pattern you'd like, I'm happy to go through and beat things into that shape.




More information about the cfe-commits mailing list