Added a set of nodes to represent requirements inside of a requires expression (EXPR_REQ, TYPE_REQ, NESTED_REQ), and a set of nodes representing the actual checks of those requirements (VALIDEXPR_EXPR, VALIDTYPE_EXPR, CONSTEXPR_EXPR).
The VALIDEXPR_EXPR, VALIDTYPE_EXPR, and CONSTEXPR_EXPR nodes are essentially no different than TRAIT_EXPR or NOEXCEPT_EXPR nodes. They evaluate properties of an operand. This design is a little different than the previous implementation, where I rendered the syntax directly into a conjunction of those expressions. I also added a nascent implementation of __is_convertible_to since expression requirements include conversion requirements. This patch does not include instantiation or decomposition rules. I wanted to get the design reviewed before implementing the more intricate stuff. Changelog: 2013-06-24 Andrew Sutton <andrew.n.sut...@gmail.com> * gcc/cp/cxx-pretty-print.c (pp_cxx_primary_expression): Pretty print new expr/req nodes. (pp_cxx_requires_expr): New along with related functions for pretty printing requirements. * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_expr): New along with related functions for pretty printing requirements. * gcc/cp/semantics.c (convertible_to_p): Implement __is_convertible_to type trait. (trait_expr_value): Evaluate __is_convertible_to. (finish_requires_expr): Implemented, along with other functions to construct and evaluate nodes for template constraints. * gcc/cp/parser.c (cp_parser_requires_expr): Update parser using new requires expression nodes. Renamed some grammar productions to better reflect the representation of the syntax. (cp_parser_nested_requirement): Wrap results in a NESTED_REQ node. * gcc/cp/cp-tree.def: (REQUIRES_EXPR): New. (EXPR_REQ): New. (TYPE_REQ): New. (NESTED_REQ): New. (VALIDEXPR_EXPR): New. (VALIDTYPE_EXPR): New. (CONSTEXPR_EXPR): New. * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Make new nodes typed. * gcc/cp/cp-tree.h (finish_expr_requirement): New. (finish_type_requirement): New. (finish_nested_requirement): New. (finish_validexpr_expr): New. (finish_validtype_expr): New. (finish_constexpr_expr): New. * gcc/cp/error.c: (dump_expr): Pretty print new nodes. Andrew
reqexpr-2.patch
Description: Binary data