Skip to content
Snippets Groups Projects
Commit 76fa66ea authored by Patrick Palka's avatar Patrick Palka
Browse files

c++: use TREE_VEC for trailing args of variadic built-in traits

This patch makes us use TREE_VEC instead of TREE_LIST to represent the
trailing arguments of a variadic built-in trait.  These built-ins are
typically passed a simple pack expansion as the second argument, e.g.

   __is_constructible(T, Ts...)

and the main benefit of this representation change is that substituting
into this argument list is now basically free since tsubst_template_args
makes sure we reuse the TREE_VEC of the corresponding ARGUMENT_PACK when
expanding such a pack expansion.  In the previous TREE_LIST representation
we would need need to convert the expanded pack expansion into a TREE_LIST
(via tsubst_tree_list).

Note that an empty set of trailing arguments is now represented as an
empty TREE_VEC instead of NULL_TREE, so now TRAIT_TYPE/EXPR_TYPE2 will
be empty only for unary traits.

gcc/cp/ChangeLog:

	* constraint.cc (diagnose_trait_expr): Convert a TREE_VEC
	of arguments into a TREE_LIST for sake of pretty printing.
	* cxx-pretty-print.cc (pp_cxx_trait): Handle TREE_VEC
	instead of TREE_LIST of trailing variadic trait arguments.
	* method.cc (constructible_expr): Likewise.
	(is_xible_helper): Likewise.
	* parser.cc (cp_parser_trait): Represent trailing variadic trait
	arguments as a TREE_VEC instead of TREE_LIST.
	* pt.cc (value_dependent_expression_p): Handle TREE_VEC
	instead of TREE_LIST of trailing variadic trait arguments.
	* semantics.cc (finish_type_pack_element): Likewise.
	(check_trait_type): Likewise.
parent d180a552
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment