This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++-concepts] requires expressions

Now that I'm all moved, I can start sending patches again...

Attached is the finished semantics for requires expressions. I
re-org'd all the semantics and tsubst functions into
Other than that, you've seen most of this before. It's kind of a big
diff, but there's not a lot of new code.

2013-07-25  Andrew Sutton  <>
        * 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. Create a new scope
for requires
        (cp_parser_nested_requirement): Wrap results in a
        NESTED_REQ node.
        * gcc/cp/semantics.c (xvalue_result_type): New.
        (trait_expr_value): Evaluate __is_convertible_to.
        (finish_requires_expr): Implemented, along with other functions to
        construct and evaluate nodes for template constraints.
        (potential_constant_expression_1): Handle requires expressions.
        (finish_template_requirements), (finish_requires_expr), etc:
        Move to
        * gcc/cp/cp-tree.def: (REQUIRES_EXPR), (EXPR_REQ), (TYPE_REQ),
        * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Make new nodes typed.
        * gcc/cp/cp-tree.h (finish_expr_requirement),
        (finish_type_requirement), (finish_nested_requirement),
        (finish_validexpr_expr), (finish_validtype_expr),
        (finish_constexpr_expr): New.
        * gcc/cp/pt.c (convert_nontype_argument): Use can_convert_standard.
        (retrieve_local_specialization), (register_local_specialization),
        (extract_fnparm_pack): Make non-static.
        (tsubst_expr): Substitution rules for requires expressions.
        (instantiate_requirements): Move to
        (tsubst_constraint): Remove.
        * gcc/cp/call.c (can_convert): Allow user-defined conversions.
        (can_convert_standard): New.
        * gcc/cp/cvt.c (convert_to_reference): Use can_convert_standard.
        * gcc/cp/search.c (check_final_overrider): Use can_cnvert_standard.
        * gcc/cp/typeck.c (build_static_cast_1): Use can_convert_standard.
        * gcc/cp/error.c (dump_expr): Pretty print new nodes.
        * 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.
        (pp_cxx_parameter_declaration_clause): Accommodate "raw" parameter
        lists in addition to function decls.
        (pp_cxx_requirement_parameter_list): Unified with parameter decl clause.
        * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_expr): New along with
        related functions for pretty printing requirements.
        * gcc/cp/ Move header comments to top of file.
        * gcc/cp/ (reduce_requirements): Handle requires
        (diagnose_constraints): Rename and handle requires expressions.

On Sat, Jul 13, 2013 at 5:51 PM, Jason Merrill <> wrote:
> On 07/13/2013 05:37 AM, Andrew Sutton wrote:
>> There are two instantiations on purpose.
> OK.
>>> A lot of the new code in pt.c doesn't seem like it needs to be there;
>>> let's
>>> put as much in as we can.  Let's move some of the bits out
>>> of
>>> semantics.c as well.
>> I think the [fixup|declare]_local_parms could move to semantics.c.
>> Would you recommend moving tsubst_* for requirements into
> Yes, but I was thinking that [fixup|declare]_local_parms would go to
> as well.  Both semantics.c and pt.c are too large already.
> Jason

Andrew Sutton

Attachment: requires-7.patch
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]