2014-07-28 Andrew Sutton <andrew.n.sutton@gmail.com>
[official-gcc.git] / ChangeLog.concepts
blob50bf570c49b0083158b154807bda3e3944285ba4
1 2014-07-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
2         * gcc/cp/cp-tree.h (more_constraints): Remove
3         (subsumes_constraints): Renamed from more_constraints
4         (more_constrained): Repurposed
5         * gcc/cp/call-c (template_decl_for_candidates): Rename to get_temploid,
6         only get template info for member functions of a class template
7         specialization.
8         (joust): Handle member functions of class template specializations
9         separately from function templates. This matches the new wording in
10         the TS.
11         * gcc/cp/logic.cc (match_terms): Make inline.
12         (subsumes_constraints): Rename to subsumes_constraints_nonnull.
13         * gcc/cp/pt.c (is_compatible_template_arg): Use subsumes.
14         (more_specialized_fn): Use usubsumes_constraints.
15         (more_specialized_class): Use more_constrained.
16         * gcc/cp/constraint.cc (more_constraints): Removed.
17         (more_constrained): New.
19 2014-07-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
20         * gcc/cp/typeck.c (cp_build_function_call_vec): Emit diagnostic
21         at the input location.
22         * gcc/cp/error.c (dump_template_decl): Constraints are never invalid
23         in this way. Also fixes brace warning.
25 2014-07-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
26         * gcc/cp/tree.c (cp_tree_equal): compare constraint infos by
27         their associated constraints (patch by Braden Obrzut).
28         * gcc/cp/logic.c (decompose_assumptions): Don't decompose errors.
29         (subsumes_constraints): Update to use new macros.
30         * gcc/cp/cp-tree.h (tree_constraint_info): Rewrite constraints
31         to cache leading, trailing, and associated requirements.
32         (CI_SPELLING, CI_REQUIREMENTS): Remove
33         (CL_LEADING_REQS, CI_TRAILING_REQS, CI_ASSOCIATED_REQS): New
34         accessors for constraint info field.
35         (save_leading_requirements, save_trailing_requirements,
36         valid_template_requirements_p): New.
37         (make_constraints): Removed.
38         (instantiate_requirements): Add flag to substitute in either
39         dependent/non-dependent mode.
40         (tsubst_constraint_info): New.
41         * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_clause): New.
42         * gcc/cp/cxx-pretty-print.c (pp_cxx_init_declarator): Remove.
43         (pp_cxx_function_definition): Print trailing constraints if they
44         exist.
45         (pp_cxx_init_declarator): New. Print trailing requirements.
46         (pp_cxx_template_declaration): Print leading requirements.
47         (pp_cxx_requires_clause): New.
48         * gcc/cp/pt.c (build_template_decl): Ensure completion of constraints
49         when associating them with the template.
50         (add_inherited_template_parms): Update to new constraint mechanisms.
51         (redeclare_class_template): Update to new constraint mechanisms.
52         (tsubst_decl): Update to new constraint mechanism.
53         * gcc/cp/parser.c (cp_parser_lambda_expression): Save off constraints
54         in a generic lambda.
55         (cp_check_constrained_type_parm): Save leading requirements instead
56         of finishing them.
57         (cp_parser_trailing_requirements): Simplify by just saving the trailing
58         requirements.
59         (cp_parser_init_declarator): Save off constraints before parsing the
60         declarator.
61         (cp_parser_member_declaration): Save off requirements before parsing
62         the declarator.
63         (cp_parser_requires_clause): Defer constexpr check until as late as
64         possible.
65         (cp_parser_template_declaration_after_export): Save leading requirements
66         instead of finishing them.
67         (synthesize_implicit_template_parm): Save leading requirements when
68         processing a constrained-type-specifier.
69         * gcc/cp/class.c (get_member_fn_template): Update to use new constraint
70         mechanism.
71         * gcc/cp/call.c (constraint_failure): Renamed from
72         template_constraint_failure. Produce reasons for non-template functions.
73         (is_constrainable_non_template_fn): Removed.
74         (add_function_candidate): Use new constraint association framework.
75         * gcc/cp/ptree.c (cxx_print_xnode): Dump leading, trailing requirements.
76         * gcc/cp/error.c (dumpl_template_decl): Print a leading requires-clause.
77         (dump_function_decl): Print a trailing requires-clause.
78         * gcc/cp/semantics.c (finish_template_template_parm): Finish
79         template constraints before associating them.
80         * gcc/cp/constraint.cc (reduce_call): Don't fold constants when
81         substituting.
82         (reduce_template_id): Replace EXPR_LOCATION in diagnostics. Return
83         error_mark_node instead of corrected call expression.
84         (reduce_requirements): Don't normalize a null expression.
85         (make_constraints): Removed.
86         (get_constraints): Updated.
87         (set_constraint): Updated.
88         (get_shorthand_requirements): Use the appropriate macro.
89         (build_constraint_info, init_leading_requirements, 
90         init_trailing_requirements, update_leadng_requirements,
91         update_trailing_requirements, save_leading_requirements,
92         save_trailing_requirements): New.
93         (finish_template_requirements): Analyze and decompose constraints.
94         (valid_template_requirements_p): New.
95         (instantiate_requirements): New flag.
96         (tsubst_constraint_info): New.
97         (check_requirements): Update.
98         (check_constraints): Add another round of instantiation to ensure
99         that all non-constexpr exprs are folded out of the expression.
100         (check_constraints): Update.
101         (equivalent_constraints): Redefine constraint equivalence in terms
102         of tokens (patch by Braden Obrzut).
103         (diagnose_trait, diagnose_check, diagnose_requires, 
104         diagnose_constraints): Update.
105         * gcc/cp/decl2.c (check_classfn): Update constraint mechanisms.
106         * gcc/cp/decl.c (decls_match): Update to use new constraints.
107         (duplicate_decls): members match if they have equivalent constraints.
108         (get_leading_template_requirements): New.
109         (adjust_out_of_class_fn_requirements): New.
110         (grokfndecl): Associate requirements with a function declaration.
111         * gcc/testsuite/g++.dg/concepts/*: New tests.
113 2014-06-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
114         * gcc/c-family/c.opt (flag_concepts): Don't enable by default.
115         * gcc/c-family/c-opts.c (set_std_cxx1z): Enable concepts if
116         -std=cxx1z is selected.
117         * gcc/c-family/c-format.c (gcc_cxxdia): Add "Z" as format specifier.
118         * gcc/cp/c-common.c (cxx_dialect): Make -std=c++98 the default
119         language again.
120         * gcc/cp/lex.c (cxx_init): Don't set flag_concepts explicitly.
121         * gcc/testsuite/g++.dg/concepts/*.C: Update build flags.
123 2014-06-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
124         * gcc/cp/cp-tree.h (DECL_CONSTRAINTS): Remove this macro; use
125         get_constraints instead.
126         (set_constraints): new.
127         * gcc/cp/cxx-pretty-print.c (pp_cxx_template_declaration): Use
128         get_constraints.
129         * gcc/cp/pt.c (get_specialization_constraints): Use get_constraints.
130         (build_template_decl): Use get_constraints.
131         (process_partial_specialization): Use get_constraints.
132         (add_inherited_template_parms): Use get_constraints.
133         (redeclare_class_template): Use get_constraints.
134         (is_compatible_template_arg): Use get_constraints.
135         (tsubst_friend_class): Use get_constraints.
136         (tsubst_decl): Uset get_constraints.
137         * gcc/cp/semantics.c (finish_template_template_parm): Use
138         get_constraints.
139         (fixup_template_type): Use get_constraints.
140         * gcc/cp/constraint.cc (constraints): New global association
141         of declarations to constraints.
142         (get_constraints): Return the associated constraints from the
143         hash table.
144         (set_constraints): New. Associate constraints with a declaration.
145         (check_template_constraints): Use get_constraints.
146         (equivalently_constrained): Use get_constraints.
147         (more_constrained): Use get_constraints.
148         (diagnose_constraints): Use get_constraints.
149         * gcc/testsuite/g++.dg/concepts/partial-spec.C: New.
151 2014-06-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
152         * gcc/cp/parser.c (cp_parser_requires_clause): Don't fold expressions
153         when parsing a requires-clause.
154         * gcc/cp/constraint.cc (reduce_requirements): Don't fold
155         expressions during constraint normalization.
157 2014-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
158         * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): Defer
159         handling the BASELINK check until concept-resolution in order to
160         allow member conceps.
161         (cp_parser_nonclass_name): Also Check for concept-names when the
162         lookup finds a BASELINk.
163         * gcc/cp/constraint.cc: (resolve_constraint_check) If the call
164         target is a base-link, resolve against its overload set.
165         (build_concept_check): Update comments and variable names to
166         reflect actual processing.
167         * gcc/testuite/g++.dg/concepts/mem-concept.C: New test.
168         * gcc/testuite/g++.dg/concepts/mem-concept-err.C: New test.
170 2014-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
171         * gcc/cp/error.c (dump_expr): Pretty print placeholder to improve
172         debug output.
174 2014-06-17  Braden Obrzut  <admin@maniacsvault.net>
175         * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): If getting
176         a baselink, use the referred-to function/overload declarations rather
177         than asserting.
179 2014-06-12  Andrew Sutton  <andrew.n.sutton@gmail.com>
180         * gcc/cp/constraint.cc (deduce_constrained_parameter): Refactor
181         common deduction framework into separate function.
182         (build_call_check): New.
183         (build_concept_check): Take additional arguments to support the
184         creation of constrained-type-specifiers from partial-concept-ids.
185         (build_constrained_parameter): Take arguments from a partial-concept-id.
186         * gcc/cp/cp-tree.h (build_concept_check, biuld_constrained_parameter):
187         Take a template argument list, defaulting to NULL_TREE.
188         * gcc/cp/parser.c (cp_parser_template_id): Check to see if a 
189         template-id is a concept check.
190         (cp_check_type_concept): Reorder arguments
191         (cp_parser_allows_constrained_type_specifier): New. Check contexts
192         where a constrained-type-specifier is allowed.
193         (cp_maybe_constrained_type_specifier): New. Refactored common rules
194         for concept name checks.
195         (cp_maybe_partial_concept_id): New. Check for 
196         constrained-type-specifiers.
197         * gcc/testuite/g++.dg/concepts/partial.C: New tests.
198         * gcc/testuite/g++.dg/concepts/partial-err.C: New tests.
199         * gcc/testuite/g++.dg/concepts/concepts.exp: Add missing test driver.
201 2014-06-12  Andrew Sutton  <andrew.n.sutton@gmail.com>
202         * gcc/cp/parser.c (cp_check_type_concept): New.
203         (cp_check_concept_name): Remove redundant condition from check.
204         Diagnose misuse of non-type concepts in constrained type specifiers.
205         * gcc/testuite/g++.dg/concepts/generic-fn.C: Add tests for
206         non-simple constrained-type-specifiers and nested-name-specifiers
207         in concept names.
208         * gcc/testuite/g++.dg/concepts/generic-fn-err.C: New tests for
209         diagnosing ill-formed programs.
211 2014-06-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
212         * gcc/cp/cp-tree.h (build_constrained_parameter): Renamed fro
213         describe_tempalte_parm.
214         * gcc/cp/parser.c (cp_check_constrained_type_parm): New. Prevent
215         declaration of cv-qualifed or non-id types.
216         (cp_constrained_type_template_parm): Renamed, check for invalid 
217         specifiers.
218         (cp_constrained_template_template_parm): Renamed, check for invalid
219         specifiers.
220         (cp_constrained_non_type_tmeplate_parm): Renamed.
221         (cp_finish_constrained-parameter): Support checking of decarlarations.
222         (cp_check_concept_name): Renamed. Add initial support for auto
223         and constrained-type-specifiers in compound requirements.
224         (cp_parser_nonclass_name): Only check for concept names if -fconcepts
225         is on.
226         (cp_manage_requirements): New RAII guard for managinging the
227         current_template_reqs variable during declaration parsing.
228         (cp_paresr_trailing_requirements): Refactored common parsing
229         requirements from cp_parser_init_declarator and 
230         cp_parser_member_declarator. Take terse constraints from implicit
231         parameter declarations.
232         (cp_parser_init_declarator): Cleanup, refactor requirement logic.
233         (cp_parser_type_id_1): Allow auto in compound requirements.
234         (cp_parser_member_declaration): Cleanup, refactor requirement logic.
235         (cp_parser_compound_requirement): Note parsing state for the 
236         trailing-type-id so we can get auto and constrained-type-specifiers.
237         (cp_parser_function_definition_after_decl): Remove broken constraint
238         association.
239         * gcc/cp/parser.h (cp_parser): New member.
240         * gcc/cp/constraint.cc (finish_validtype_expr): Initial (non-)handling
241         of auto in type requirements.
242         (finish_concept_name): Moved to cp_check_concept_name.
243         * gcc/testuite/g++.dg/concepts/constrained-parm.C: New test.
244         * gcc/testuite/g++.dg/concepts/generic-fn.C: New test.
247 2014-03-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
248         * gcc/testuite/g++.dg/concepts/fn1.C: New test.
249         * gcc/testuite/g++.dg/concepts/fn2.C: New test.
251 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
252         * gcc/cp/parser.c (synthesize_implicit_template_parm): Allow concepts
253         to declare implicit template parameters. Only synthesize new parameters
254         if the concept name is new.
255         (finish_concept_name): Moving into parser.c for the time being. Needs
256         to be rewritten to remove duplicate code between parser.c and
257         constraint.cc.
259 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
260         * gcc/cp/pt.c (tsubst_copy): Expand pack expansions as conjunctions.
262 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
263         * gcc/cp/pt.c (tsubst_pack_conjunction): Don't try to conjoin
264         dependent expressions.
266 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
267         * gcc/cp/semantics.c (fixup_template_type): Compare primary template
268         types to specializations using structural types so we don't run into
269         canonical type errors with constrained specializations.
271 2013-11-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
272         * gcc/cp/pt.c (add_inherited_template_parms): Instantiate requirements
273         in a processing template decl context.
275 2013-11-05  Andrew Sutton  <andrew.n.sutton@gmail.com>
276         * gcc/cp/semantics.c (fixup_template_type): Add a same-type check
277         for specialiations so we don't accidentally match non-dependent
278         specializations having a different type.
280 2013-10-26  Ville Voutilainen  <ville.voutilainen@gmail.com>
281         * gcc/cp/decl.c (grokdeclarator): Reject concept keyword
282         in typedefs, function parameters, data members, non-static
283         member functions and variables. Allow static member functions
284         to be concepts.
286 2013-10-30  Andrew Sutton  <andrew.n.sutton@gmail.com>
287         * gcc/cp/semantics.c (fixup_template_type): Don't emit errors when
288         no templates can be found with matching constraints.
290 2013-10-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
291         * gcc/cp/parsre.c (cp_parser_requires_expression): Gracefully
292         fail when parsing a requires expr outside a template.
294 2013-10-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
295         * gcc/cp/c-common.c (c_common_r): Remove unused keywords "assume",
296         "axiom", and "forall".
297         * gcc/cp/c-common.h (rid): Removed unused reserved word ids.
299 2013-10-24  Edward Smith-Rowland  <3dw4rd@verizon.net>
300         * gcc/cp/typeck.c (cp_build_function_call_vec): Use unused variable 
301         loc.
303 2013-10-23  Andrew Sutton  <andrew.n.sutton@gmail.com>
304         * gcc/cp/class.c (get_member_fntemplate): New.
305         (are_constrained_member_overloads): Only get a template declaration
306         if the member function is, in fact, a template or temploid.
307         * gcc/cp/pt.c (check_explicit_specialization): Do not allow
308         explicit specializations to be declared 'concept', and do not allow
309         an explicit specialization of a concept.
310         * gcc/cp/decl.c (grokfndecl): Propagate the concept flag to
311         check_explicit_specialization.
313 2013-10-22  Andrew Sutton  <andrew.n.sutton@gmail.com>
314         * gcc/c-family/c-common.c (cxx_dialect): Make the default
315         language C++11.
316         * gcc/cp/constraint.cc (check_constrained_friend): Don't assert
317         on error_mark_node.
319 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
320         * gcc/cp/logic.cc (left_requires), (decompose_left): Add
321         decomposition rules for requires expressions.
322         (subsumes_requires), (subsumes_prop): Add subsumption rules for
323         requires expressions.
324         * gcc/cp/constraint.cc (diagnose_trait): Diagnose failed conversion
325         requirements.
327 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
328         * gcc/cp/constraint.cc (finish_concept_name): Allow functions with
329         the same name as concepts to resolve as call expressions in the
330         usual way.
332 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
333         * gcc/cp/constraint.cc (conjoin_requiremens): New.
334         (resolve_constraint_check): Filter non-concept candidates before
335         coercing arguments. Perform deduction in a template-decl processing
336         context to prevent errors during diagnosis.
337         (finish_concept_name), (finish_shorthand_requirement),
338         (get_shorthand_requirements): New.
339         * gcc/cp/pt.c (template_parm_to_arg): Make non-static.
340         (process_templat_parm): Build shorthand requirements from the
341         parameter description.
342         (end_templat_parm_list): New.
343         (convert_placeholder_argument): New.
344         (convert_template_argument): Match placeholder arguments against
345         any template parameter.
346         (tsubst_pack_conjuction):  New.
347         (tsubst_expr): Expand a pack as a conjunction.
348         (type_dependent_expression_p): Placeholders are always type
349         dependent.
350         * gcc/cp/parser.c (cp_is_constrained_parameter), 
351         (cp_finish_template_type_parm), (cp_finish_template_template_parm)
352         (cp_finish_non_type_template_parm), (cp_finish_constrined_parameter):
353         New.
354         (cp_parser_template_parameter): Handle constrained parameters.
355         (cp_parser_nonclass_name): An identifier naming an overload set
356         may declare a constrained parameter.
357         (cp_parser_type_parameter), (cp_parser_template_declaration_after_exp): 
358         Get shorthand requirements from the tmeplate parameter list.
359         * gcc/cp/cp-tree.h (TEMPLATE_PARM_CONSTRAINTS): New.
361 2013-10-07  Andrew Sutton  <andrew.n.sutton@gmail.com>
362         * gcc/cp/cp-tree.h (check_constrained_friend): Take requirements as
363         an argument.
364         * gcc/cp/constraints.cc (check_constrained_friend): Do not diagnose
365         errors in unconstrained friend declarations.
366         * gcc/cp/parser.cc (cp_parser_member_declaration): Pass current
367         requirements to check_constrained_friend.
369 2013-10-07  Andrew Sutton  <andrew.n.sutton@gmail.com>
370         * gcc/cp/parser.c (cp_parser_member_declaration): Check that
371         a constrained friend definition is valid.
372         * gcc/cp/decl.c (grokfndecl): Disallow constrained friend template
373         specializations.
374         * gcc/cp/constraints.cc (check_constrained_friend): New.
375         * gcc/cp/typeck.c (cp_build_function_call_vec): Diagnose constraints
376         in the presence of the failure of a single candidate.
377         * gcc/cp/cp-tree.h (check_constrained_friend): New.
378         * gcc/cp/call.c (is_non_template_member_fn): Make inline.
379         (is_non_template_friend), (is_constrainable_non_template_fn): New.
380         (add_function_candidate): Predicate check on
381         is_constrainable_non_template_fn.
383 2013-09-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
384         * gcc/cp/cp-tree.h (TEMPLATE_PARMS_CONSTRAINTS): New.
385         * gcc/cp/parser.c (cp_parser_template_declaration_after_export),
386         (cp_parser_type_parameter): Use TEMPLATE_PARMS_CONSTRAINTS.
387         * gcc/cp/semantics.c (fixup_template_scope): Use 
388         TEMPLATE_PARMS_CONSTRAINTS.
390 2013-09-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
391         * gcc/cp/cxx-pretty-print.c (pp_cxx_compound_requirement),
392         (pp_cxx_type_requirement), (pp_cxx_validtype_expr): Use 
393         pp->type_id() instead of pp_cxx_type_id().
395 2013-09-09  Andrew Sutton  <andrew.n.sutton@gmail.com>
396         * gcc/cp/pt.c (get_class_bindings): Pass the partial specialization
397         for constraint evaluation. Evaluate constraints, resulting in
398         deduction failure on error.
399         (get_specializaing_template_decl), (get_specialization_constraints),
400         (maybe_new_partial_specialization): New.
401         (maybe_process_partial_specialization): Allow the creation of
402         new types for constrained partial specializations.
403         (process_partial_specialization): Modify the canonical type
404         of constrained partial specializations.
405         (instantiate_class_template_1): Do not explicitly check constraints
406         during class template instantiation.
407         (tsubst_decl): Instantiate the constraints of template declarations.
408         (more_specialized_class): Pass specializations to get_class_bindings().
409         Compare specialization constraints if the types are equivalent.
410         (most_specialized_class): Pass specialization to get_class_bndings().
411         * gcc/cp/decl2.c (check_class_fn): Get the decl's requirements from
412         either the current template reqs or from the template parameters.
413         Allow overloading of constrained out-of-class member definitions.
414         * gcc/cp/semantics.c (fixup_template_type): New. Match the template
415         scope to a specialization with appropriate constraints.
416         (finish_template_type): Fix template type when entering scope.
417         * gcc/cp/parser.c (cp_parser_parse_type_parameter): Attach
418         requirements to the current template parameter list.
419         (cp_parser_init_declarator): Parse requires clauses for out-of-class
420         member definitions. Be sure to restore current constraints before
421         exiting the function.
422         (cp_parser_member_declarator): Restore the previous requirements in
423         an early-exit branch.
424         (cp_parser_late_parsing_for_member): Restore constraints after
425         maybe_end_member_template_processing().
426         (cp_parser_template_declaration_after_exp): Attach constraints to
427         the current template parameters.
428         * gcc/cp/constraint.cc (reduce_template_id): Don't crash when
429         omitting ()'s on constraint calls.
430         (check_requirements): Don't evaluate dependent arguments.
431         (check_constraints): Don't try to evaluate when arguments are
432         dependent.
433         (equivalent_constraints): Optimize the case when a and b are the
434         same constraints.
436 2013-07-26  Andrew Sutton  <andrew.n.sutton@gmail.com>
437         * gcc/cp/semantics.c (trait_expr_value): Evaluate __is_same_as.
438         (finish_trait_expr): Check __is_same_as and __is_convertible_to.
439         * gcc/cp/constraint.cc (diagnose_trait): Diagnose failures in
440         __is_same_as.
441         * gcc/cp/parser.c (cp_parser_primary_expression), 
442         (cp_parser_trait_expr): Parse __is_same_as.
443         * gcc/cp/cp-tree.h (cp_trait_kind): Add CPTK_IS_SAME_AS.
444         * gcc/cp/cxx-pretty-print.c (pp_cxx_trait_expression): Pretty print
445         __is_same_as trait.
447 2013-07-26  Andrew Sutton  <andrew.n.sutton@gmail.com>
448         * gcc/cp/tree.c (cp_walk_subtrees): Don't recurse through the
449         requires expr parameter list.
451 2013-07-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
452         * gcc/cp/parser.c (cp_parser_requires_expr): Update parser using new
453         requires expression nodes. Renamed some grammar productions to better 
454         reflect the representation of the syntax. Create a new scope for 
455         requires parameters.
456         (cp_parser_nested_requirement): Wrap results in a NESTED_REQ node.        
457         * gcc/cp/semantics.c (xvalue_result_type): New.
458         (trait_expr_value): Evaluate __is_convertible_to.
459         (finish_requires_expr): Implemented, along with other functions to
460         construct and evaluate nodes for template constraints.
461         (potential_constant_expression_1): Handle requires expressions.
462         (finish_template_requirements), (finish_requires_expr), etc:
463         Move to constraint.cc.
464         * gcc/cp/cp-tree.def: (REQUIRES_EXPR), (EXPR_REQ), (TYPE_REQ),
465         (NESTED_REQ), (VALIDEXPR_EXPR), (VALIDTYPE_EXPR), (CONSTEXPR_EXPR):
466         New.
467         * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Make new nodes typed.
468         * gcc/cp/cp-tree.h (finish_expr_requirement), 
469         (finish_type_requirement), (finish_nested_requirement),
470         (finish_validexpr_expr), (finish_validtype_expr),
471         (finish_constexpr_expr): New.
472         * gcc/cp/pt.c (convert_nontype_argument): Use can_convert_standard.
473         (retrieve_local_specialization), (register_local_specialization),
474         (extract_fnparm_pack): Make non-static.
475         (tsubst_expr): Substitution rules for requires expressions.
476         (instantiate_requirements): Move to constraints.cc
477         (tsubst_constraint): Remove.
478         * gcc/cp/call.c (can_convert): Allow user-defined conversions.
479         (can_convert_standard): New.
480         * gcc/cp/cvt.c (convert_to_reference): Use can_convert_standard.
481         * gcc/cp/search.c (check_final_overrider): Use can_cnvert_standard.
482         * gcc/cp/typeck.c (build_static_cast_1): Use can_convert_standard.
483         * gcc/cp/error.c (dump_expr): Pretty print new nodes.
484         * gcc/cp/cxx-pretty-print.c (pp_cxx_primary_expression): Pretty
485         print new expr/req nodes.
486         (pp_cxx_requires_expr): New along with related functions for
487         pretty printing requirements.
488         (pp_cxx_parameter_declaration_clause): Accommodate "raw" parameter
489         lists in addition to function decls.
490         (pp_cxx_requirement_parameter_list): Unified with parameter decl clause.
491         * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_expr): New along with
492         related functions for pretty printing requirements.     
493         * gcc/cp/logic.cc: Move header comments to top of file.
494         * gcc/cp/constraint.cc (reduce_requirements): Handle requires
495         expressions.
496         (diagnose_constraints): Rename and handle requires expressions.
498 2013-07-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
499         * gcc/cp/error.c (cp_printer): Fix unnecessary whitespace change.
500         * gcc/cp/constraint.cc (diagnose_node): Don't fail diagnosing
501         disjunctions.
503 2013-07-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
504         * gcc/cp/class.c (are_constrained_member_overloads): Fix doc typos.
506 2013-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
507         * gcc/cp/parser.c (cp_parser_init_declarator): Parse template
508         requirements for out-of-class member definitions.
509         * gcc/cp/decl2.c (check_classfn): Include match out-of-class
510         definitions using constraints.
511         * gcc/cp/constraint.cc (equivalently_constrained). Use get_constraints.
512         (more_constrained). Use get_constraints. 
514 2013-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
515         * gcc/cp/cp-tree.h (tree_template_info). Remove constraint from 
516         template info.
517         (check_template_info): Removed (unused).
518         (TI_CONSTRAINT): Removed (no longer needed) along with related macros.
519         (DECL_CONSTRAINTS): New. Get constraints from DECL_SIZE_UNIT for 
520         template decls.
521         (build_template_info): Removed overload taking constraints.
522         (get_constraints): Removed (no longer needed).
523         * gcc/cp/class.c (are_constrained_member_overlaods): Allow constrained 
524         member function templates to be differentiated as overloads.
525         * gcc/cp/decl.c (decls_match): Only compare constraints on 
526         declarations.
527         (grokfndecl): Don't pass constraints to build_template_info.
528         * gcc/cp/tree.c (bind_template_template_parm): Don't pass constraints 
529         to build_template_info.
530         * gcc/cp/pt.c (build_template_info): Removed overload taking 
531         constraints.
532         (check_explicit_specialization): Don't build new constraints for 
533         template info.
534         (build_template_decl): Pass constraints. Update docs.
535         (process_partial_specialization): Stub out support for constrained
536         partial specialiations.
537         (push_template_decl_real): Build template decls with current template 
538         reqs. Don't pass constraints to build_template_info.
539         (add_inherited_template_parms): Build new constraints from inherited
540         template constructors.
541         (redeclare_class_template): Update to new constraint interface.
542         (is_compatible_template_arg): Update to new constraint interface.
543         (lookup_template_class_1): Don't build new constraints or pass them to
544         build_template_info.
545         (instantiate_class_template_1): Update to new constraints interface.
546         (tsubst_decl): Don't build new constraints or pass them to
547         build_template_info. For function templates, explicitly instantiate
548         new constraints for member functions of class templates.
549         * gcc/cp/semantics.c: Associate constraints with template template 
550         parms directly, not through template info.
551         * gcc/cp/constraint.cc (get_constraints): Simplified to use new constraints
552         interface.
553         (check_constraints): Update to use new constraints interface.
554         (equivalently_constrained): Update to use new constraints interface.
555         (more_constrained): Update to use new constraints interface.
556         * gcc/cp/parser.cpp (cp_parser_late_parsing_for_member): Update to use 
557         new constraints interface.
558         * gcc/cp/call.c (is_non_template_member_fn): New.
559         (add_function_candidate): Only check constraints for non-template member
560         functions.
562 2013-06-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
563         * gcc/cp/parser.c (cp_parser_requires_clause): Pulled out of
564         cp_parser_requires_clause_opt for reuse in the requires expr parser.
565         (cp_parser_requires_expression): New, along with a family of
566         sub-expression parsers for the new feature.
567         * gcc/cp/semantics.c (finish_requires_expr): Stub.
568         (finish_syntax_requirement): Stub.
569         (finish_type_requirement): Stub.
570         (finish_constexpr_requirement): Stub.
571         (finish_noexcept_requirement): Stub.
572         (finish_requires_expr): Stub.
573         * gcc/cp/cp-tree.h: (finish_requires_expr): New.
574         (finish_syntax_requirement): New.
575         (finsih_type_requirement): New.
576         (finish_constexpr_requirement): New.
577         (finish_noexcept_requirement): New.
579 2013-06-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
580         * gcc/cp/error.c (subst_to_string): Allow this to be called explicitly
581         passing template parameters in the TREE_TYPE and with a null 
582         TREE_PURPOSE.
583         * constraint.cc (check_requirements): New overload taking template
584         arguments.
585         (check_constraints.cc): Move instantiation and checking into the
586         new check_requirements overload.
587         (diagnose_requirements): New family of functions for diagnosing 
588         constraint failures.
590 2013-06-18  Andrew Sutton  <andrew.n.sutton@gmail.com>
591         * gcc/cp/class.c (are_constrained_member_overloads): New.
592         (add_method): Allow overloading of constrained member functions.
593         * gcc/cp/call.c (rejection_reason_code): New rr_constraint_failure.
594         (template_constraint_failure): New.
595         (add_function_candidate): Check for viability as a precondition to use.
596         (add_template_candidate_real): Integrate constraint diagnostics.
597         Provide constraint info for new template instantiations.
598         (print_z_candidate): Emit diagnostics for constraint failures.
599         (template_decl_for_candidate): New.
600         (joust): Allow non-member templates of class templates to be evaluated
601         in more_specialized_fn if they are constrained.
602         * gcc/cp/ptree.c (cxx_print_xnode): Dump constraint info.
603         * gcc/cp/semantics.c (finish_template_template_parm): Build template
604         info for template template parameters.
605         (is_unary_trait): New.
606         (is_binary_trait): New.
607         (finish_trait_expr): Check for binary traits using new function.
608         * gcc/cp/constraint.cc (join_requirements): New
609         (conjoin_requirements): Join expressions correctly. Fixed docs.
610         (disjoin_requirements): Removed.
611         (is_constriant): Removed.
612         (resolve_constraint_check): New. Replaces previous get_constraint
613         check and related functions.
614         (get_constraints): New, along with helper functions.
615         (suppress_template_processing): New. 
616         (check_template_constraints): New, along with helper functions.
617         (equivalent_constraints): New.
618         (equivalently_constrained): New.
619         (more_constraints): New.
620         (more_constrianed): New.
621         (diagnose_constraint_failure): New.
622         * gcc/cp/decl.c (decls_match): Check for constraint equivalence if
623         the types are the same.
624         (check_concept_refinement): New.
625         (are_constrained_overloads): New.
626         (duplicate_decls): Handle constraints for ambigous declarations. Check
627         and diagnose concept refinement.
628         (check_concept_fn): Don't fail completely just because the concept
629         isn't defined correctly. Allow analysis to continue as if declared
630         constexpr. Concepts must return bool.
631         * gcc/cp/tree.c (bind_template_template_parm): Provide empty 
632         constraints for bound template template parameters.
633         * gcc/cp/logic.cc: Rewrite of proof state and related structures and
634         decomposition logic. Removed right-decomposition logic, but retained
635         right-logical rules.
636         (match_terms): Renamed from entails.
637         (subsumes_prop): Cleanup, added specific handlers for and/or cases.
638         (subsumes_constraints): Update from interface change.
639         * gcc/cp/cp-tree.h (check_constraint_info): Renamed and applied
640         interface change.
641         (check_template_info): Renamed and applied interface change.
642         (cp_unevaluated): New
643         (local_specialization_stack): New.
644         (coerce_template_parms): New.
645         (is_unary_trait): New.
646         (is_binary_trait): New.
647         (get_constraints): New.
648         (check_constraints): New.
649         (check_template_constraints): New.
650         (subst_template_constraints): New.
651         (equivalent_constraints): New.
652         (equivalently_constrained): New.
653         (more_constraints): New.
654         (more_constrained): New.
655         (diagnose_constraints_failure): New.
656         * gcc/cp/cxx-pretty-print.c (pp_cxx_template_declaration): Print the
657         template requirements.
658         * gcc/cp/pt.c (local_specialization_stack): New.
659         (build_template_info): Refactor into 3-argument version and 
660         incorporate template requirements.
661         (check_explicit_specialization): Instantiate requirements for
662         template info.
663         (push_template_decl_real): Include constraints in template info.
664         (redeclare_class_template): Diagnose redeclaration with different
665         constraints.
666         (is_compatible_template_arg): New.
667         (convert_template_argument): Check constraints on template template
668         arguments and diagnose errors.
669         (lookup_template_class_1): Check constraints on alias templates.
670         Keep constraints with instantiated types.
671         (instantiate_class_template_1): Check constraints on class templates.
672         (tsubst_decl): Instantiate and keep constraints with template info.
673         Also, allow dependent pack arguments to produce neww parameter
674         packs when instantiated.
675         (coerce_template_parms): New overload.
676         (tsubst_copy): Handle REAL_TYPE and BOOLEAN_TYPE.
677         (tsubst_copy_and_build): PARM_DECLs can be instantiated as pack
678         expansions (used with requires expression).
679         (fn_type_unification): Check constraints for function templates.
680         (more_specialized_fn): Determine which candidate is more constrained.
681         (substitute_template_parameters): Removed.
682         (tsubst_constraint): New.
683         (substitute_requirements): New.
684         * gcc/cp/parser.c: (cp_parser_optional) Removed along with helper
685         functions, etc.
686         (cp_unevaluated): New.
687         (cp_parser_type_parameter): Check for requires kw explicitly, and
688         save/clear template requirements before parsing the requires clause.
689         (cp_parser_requires_clause): Removed.
690         (cp_parser_template_declaration_after_exp): Check for requires kw
691         explicitly.
692         * gcc/system.h (cstdlib): Removed include.
693         * gcc/c-family/c-common.h (D_CXX_CONCEPTS): New flag for disabling
694         concept keywords.
695         * gcc/c-family/c.opt (flag_concepts): Remove redundant declaration.
696         * gcc/c-family/c-common.c (c_common_r): Concept-specific keywords
697         are only enabled when concepts are enabled.
699 2013-06-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
700         * gcc/system.h (cstdlib): Include <cstdlib> to avoid poisoned
701         declaration errors.
702         * gcc/c-family/common.c (c_common_r): Added __is_same_as intrinsic,
703         removed previous, unused intrinsics.
704         * gcc/c-family/common.h (rid): Added RID_IS_SAME_AS.
705         * gcc/cp/parser.c (take): New.
706         (cp_requires_clause): New.
707         (cp_requires_clause_opt): New.
708         (cp_rule): New.
709         (cp_parser_optional_if_token): New.
710         (cp_parser_optional_if_not_token): New.
711         (cp_parser_optional_if_keyword): New.
712         (cp_parser_decl_specifier_seq): Parse 'concept' as a declspec.
713         (cp_parser_type_parameter): Parse constrained template template parms.
714         (cp_parser_member_specification_opt): Parse member constraints after
715         the declaration, not before.
716         (cp_parser_template_declaration_after_exp): Rewrote parsing for
717         template requirements
718         (cp_parser_late_parsing_for_member): Re-push the current template 
719         requirements when late-parsing member definitions.
720         * gcc/cp/decl.c (check_concept_fn): New.
721         (grokfndecl): Semantics for concept declspec.
722         (grokdeclarator): Semantics for concept declspec.
723         (xref_tag_1): Update to new interface.
724         * gcc/cp/constraint.cc (make_constraints): New.
725         * gcc/cp/cp-objcp-common.c (cp_tree_size): Add case for constraint_info.
726         * gcc/cp/cp-tree.h (require): New.
727         (tree_template_info): Add a field for constraint info.
728         (tree_constraint_info): New.
729         (constraint_info_p): New.
730         (template_info_p): New.
731         (CI_SPELLING): New.
732         (CI_REQUIREMENTS): New.
733         (CI_ASSUMPTIONS): New.
734         (TI_CONSTRAINT): New.
735         (TI_SPELLING): New.
736         (TI_REQUIREMENTS): New.
737         (TI_ASSUMPTIONS): New.
738         (DECL_TEMPLATE_CONSTRAINT): New.
739         (CLASSTYPE_TEMPLATE_CONSTRAINT): New.
740         (ENUM_TEMPLATE_CONSTRAINT): New.
741         (TEMPLATE_TEMPLATE_PARM_TEMPLATE_CONSTRAINT): New.
742         (TYPE_TEMPLATE_CONSTRAINT): New.
743         (cp_tree_node_structure_enum): Added entry for constraint info.
744         (lang_tree_node): Added entry for constraint info.
745         (lang_decl_base): Added bit for concept declarations.
746         (DECL_DECLARED_CONCEPT_P): New.
747         (cp_decl_spec): Added ds_concept declaration specifier.
748         * gcc/cp/Make-lang.in (logic.o): New target.
749         * gcc/cp/semantics.c (finish_template_requirements): Rewrite.
750         * gcc/cp/logic.cc: New
751         * gcc/cp-tree.def (CONSTRAINT_INFO): New node.
752         * gcc/cp/pt.c (current_template_args): Make non-static.
753         (redeclare_class_template): Take constraints as a 3rd argument
755 2013-04-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
756         
757         * gcc/cp/Make-lang.in: Add constraints.o target.
758         * gcc/cp/cp-tree.h (substitute_template_parameters): Declare.
759         (instantiate_requirements): Declare.
760         (conjoin_requirements): Declare.
761         (disjoin_requirements): Declare.
762         (reduce_requirements): Declare.
763         * gcc/cp/pt.c (substitute_template_parameters): Define.
764         (instantiate_requirements): Define.
765         * gcc/cp/pt.c (finish_template_requirements): Call
766         reduce_requirements to get constraints.
767         * gcc/cp/parser.c (cp_parser_type_parameter): Restore saved
768         constraints after parsing template template parameter decl.
769         * gcc/cp/constraints.cc: New.
771 2013-03-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
772         * gcc/cp/Make-lang.in: Add constraint.c
773         * gcc/cp/constraint.c: New
774         (conjoin_requirements): New
775         (disjoin_requirements): New
776         (requirement_reduction): New class
777         (reduce_requirements): New
778         * gcc/cp/cp-tree.h (reduce_requrements): New
779         (conjoin_requirements): New
780         (disjoin_requirements): New
781         * gcc/cp/cp-tree.h (finish_template_template_parm) Comments.
782         * gcc/cp/semantics.c (finish_template_requirements) Start
783         working with requirements.
786 2013-03-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
788         * gcc/cp/cp-tree.h (saved_scope): Add template requirements.
789         (finish_template_requirements): Declare
790         * gcc/cp/parser.c (cp_parser_template_requirement_opt): Declare.
791         (cp_parser_template_declaration): Document grammar extensions.
792         (cp_parser_type_parameter): Parse requirements for template
793         template parameters.
794         (cp_parser_member_declaration): Parse requirements for
795         members of class templates.
796         (cp_parser_template_requirement_opt): Define.
797         (cp_parser_template_declaration_after_exp): Parse requirements
798         for template declarations.
799         * gcc/cp/semantics.c (finish_template_requirements): Define.
800         * gcc/cp/lex.c (cxx_init): Enable concepts by default.
802 2013-03-01  Gabriel Dos Reis  <gdr@integrable-solutions.net>
804         * lex.c (flag_concepts): Revert left over declaration.
806 2013-03-01  Gabriel Dos Reis  <gdr@integrable-solutions.net>
808         * gcc/c-family/c-common.c (cxx_dialect): Set C++11 as default.
809         * gcc/c-family/c.opt(flag_concepts): Add.
810         * gcc/cp/lex.c (flag_concepts): New.  Enabled concept support by
811         default.
813 2013-02-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
815         * gcc/c-family/c-common.h (rid): New resreserved words for concepts.
816         * gcc/c-family/c-common.c (c_common_reswords): Definitions thereof.
817         * gcc/doc/extend.texi (write_symbol): Initial concept docs.