Hi,

On 09/30/2014 07:13 PM, Jason Merrill wrote:
Ville asked for help with the necessary compiler intrinsics for the is_trivially_* C++11 library traits.

The first patch cleans up a few oddities I noticed with the existing intrinsics. __is_convertible_to was never implemented and isn't needed. There's no need for a second grokdeclarator in trait parsing since cp_parser_type_id already does a grokdeclarator. And the assert at the top of finish_trait_expr is redundant with the gcc_unreachable in the switch.

The second patch adds __is_trivially_copyable, which just uses the existing trivially_copyable_p predicate in the compiler.

The third patch adds __is_trivially_assignable and __is_trivially_constructible, which work by building up an expression representing assignment or object declaration and then scanning it for calls to functions other than trivial special member functions. Note that there are still bugs in trivial_fn_p that are exposed by this intrinsic.
Great. I think this can be as well marked as PR c++/26099.

By the way, if I remember correctly, the idea of having __is_convertible_to leading to unimplemented instead of simply being not recognized, goes back to this kind of idea:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2518.html

and Intel too was in favor of somewhat standardizing those intrinsics. In fact, both current icc and clang++ accept and implement __is_convertible_to.

Paolo.

Reply via email to