This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[c++-concepts] class template constraints


Attached is a patch that deals with class template constraints. In
particular, it does 3 things:

1. Type constraints are checked on lookup rather than instantiation.
2. Initial support for constrained out-of-class definitions is added
(more work needed)
3. Support for constrained partial template specialization is added.

Change Log:

2013-08-02  Andrew Sutton  <andrew.n.sutton@gmail.com>
        * gcc/cp/pt.c (get_class_bindings): Pass the partial specialization
        for constraint evaluation. Evaluate constraints, resulting in
        deduction failure on error.
        (get_specializaing_template_decl), (get_specialization_constraints),
        (maybe_new_partial_specialization): New.
        (maybe_process_partial_specialization): Allow the creation of
        new types for constrained partial specializations.
        (process_partial_specialization): Modify the canonical type
        of constrained partial specializations.
        (lookup_template_class_1): Check constraints on lookup. Do not
        explicitly check alias constraints.
        (instantiate_class_template_1): Do not explicitly check constraints
        during class template instantiation.
        (more_specialized_class): Pass specializations to get_class_bindings().
        Compare specialization constraints if the types are equivalent.
        (most_specialized_class): Pass specialization to get_class_bndings().
        * gcc/cp/constraint.cc (reduce_template_id): Don't crash when
        omitting ()'s on constraint calls.
        (check_constraints): Don't try to evaluate when arguments are
        dependent.
        (equivalent_constraints): Optimize the case when a and b are the
        same constraints.
        * gcc/cp/decl2.c (check_class_fn): Allow overloading of constrained
        out-of-class member definitions.
        * gcc/cp/parser.c (cp_parser_init_declarator): Parse requires
        clauses for out-of-class member definitions. Be sure to restore
        current constraints before exiting the function.
        (cp_parser_late_parsing_for_member): Restore constraints after
        maybe_end_member_template_processing().

Andrew

Attachment: template-1.patch
Description: Binary data


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