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