2015-05-19 Andrew Sutton <andrew.n.sutton@gmail.com>
[official-gcc.git] / ChangeLog.concepts
blob85d462bd35aff81027d041868dd4de0e1f36f7cd
1 2015-05-19  Andrew Sutton  <andrew.n.sutton@gmail.com>
3         Handle naked non-type template arguments as constraints.
4         * gcc/cp/constraint.cc (xform_misc): Removed.
5         (transform_expr): All misc tree classes are atomic constraints.
6         * gcc/testsuite/g++.dg/concepts/req1.C: Add new test cases.
8 2015-05-18  Andrew Sutton  <andrew.n.sutton@gmail.com>
10         Fix long-standing regression in template introductions.
11         * gcc/cp/parser.c (cp_parser_template_declaration_after_export):
12         Return bool.
13         (cp_parser_template_parameter_list): Remove #ifdeffing.
14         (cp_parser_member_declaration): Check for template introductions.
15         (cp_parser_template_declaration_after_parameters): New. Parse
16         a template declaration following the declaration or introduction
17         of template parameters.
18         (cp_parser_template_introduction): Save and restore scopes when
19         tentatively parsing a template introduction. Update diagnostics.
20         (cp_parser_explicit_template_declaration): Renamed from 
21         cp_parser_template_declaration_after_export. Parse a template
22         declartion that begins with the template keyword. Use
23         cp_parser_template_declaration_after_parameters to parse the
24         declaration after parsing the header.
25         (cp_parser_template_declaration_after_export): Use either
26         cp_parser_template_introduction or 
27         cp_parser_explicit_template_declaration.
28         * gcc/testsuite/g++.dg/concepts/intro4: Remove spurios diagnostic.
29         * gcc/testsuite/g++.dg/concepts/intro6: New.
31 2015-05-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
33         PR66091
34         * gcc/cp/cp-tree.h (get_function_declarator): New.
35         * gcc/cp/decl.c (get_trailing_requires_clause): Use 
36         get_function_declarator.
37         * gcc/cp/parser.c (function_declarator_p): Likewise.
38         (cp_parser_declarator): Stop invoking undefined behavior
39         and install the requires clause on the found function 
40         declarator.
41         * gcc/testsuite/g++.dg/concepts/pr66091.C: New.
43 2015-05-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
45         Addressing review comments.
46         * gcc/cp/call.c (build_new_function_call): Don't check for
47         template parameters when we're not processing a template decl.
48         * gcc/cp/constraint.cc (function_concept_check_p): Use
49         get_first_fn.
50         (satisfy_expression_constraint): Move sentinel into cp-tree.h.
51         * gcc/cp/parser.c (cp_parser_declarator): Use function_declarator_p.
52         * gcc/cp/cp-tree.h (struct deferring_access_check_sentinel): Moved
53         from constraint.cc.
54         * gcc/cp/semantics: (finish_call_expr) Don't remove constraints.
56 2015-05-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
58         Use the substituted type, not the deduced arguments, to
59         check placeholder constraints.
60         * gcc/cp/pt.c (do_auto_deduction): Check constraints using
61         the deduced type and not the deduced arguments.
62         (tsubst): Don't substitute through constraints.
63         * gcc/cp/cxx-pretty-print.c (cxx_pretty_printer::expression):
64         Print trait expressions.
65         (pp_cxx_implicit_conversion_constraint,
66         pp_cxx_argument_deduction_constraint): Clean up printing.
67         * gcc/testsuite/g++.dg/concepts/placeholder2.C: Update tests
68         to require extra substitutions.
70 2015-05-07  Andrew Sutton  <andrew.n.sutton@gmail.com>
72         Implement argument deduction constraints.
73         * gcc/cp/cp-tree.def (DEDUCT_CONSTR): Add a third operand.
74         * gcc/cp/cp-tree.h (auto_deduction_context): New. Flags to control
75         diagnostics in auto deduction.
76         (do_auto_deduction): New overload to allow for control of diagnostics.
77         (tsubst_constraint): Make extern.
78         * gcc/cp/pt.c (tsubst): Propagate constraints for place holders.
79         (do_auto_deduction): New overload that calls the expanded version
80         with default args. 
81         (do_auto_deduction): Control diagnostics with tf_subst_flags and
82         auto_deduction_context.
83         (do_auto_deduction): Only check constraints for when not using
84         decltype(auto).
85         * gcc/cp/constraint.cc (xform_compound_requirement): Build argument
86         deduction constraints.
87         (xform_atomic): Don't check the types of dependent expressions,
88         even when not processing templates.
89         (satisfy_argument_deduction_constraint): Implement this.
90         * gcc/testsuite/g++.dg/concepts/placeholder1.C: Add tests for
91         more complex failures.
92         * gcc/testsuite/g++.dg/concepts/placeholder2.C: New.
94 2015-05-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
96         Initial implementation of constrained-type-specifiers for variable 
97         declarations. Also updating documentation and style.
98         * gcc/cp/cp-tree.h (make_constrained_auto): New.
99         (evaluate_constraints): New.
100         (check_constraint_epression): Renamed and made static.
101         * gcc/cp/pt.c (do_auto_deduction): Check constraints on
102         constrained placeholders before forming the type.
103         * gcc/cp/parser.c (cp_parser_postfix_expression): Don't
104         allow constrained-type-specifiers within the first term
105         of a postfix expression.
106         (cp_parser_allows_constrained_type_specifier): Removed.
107         (cp_maybe_constrained_type_specifier): Don't process
108         nodes as constrained type specifiers unless they look like
109         constrianed type specifiers, and only when they are allowed.
110         Also, support constrained auto for placeholders. Renamed 
111         variables to better reflect usage.
112         gcc/cp/parser.h (struct cp_parser): New member
113         prevent_constrained_type_specifiers.
114         gcc/cp/decl.c (grokfndecl): Remove commented code.
115         gcc/cp/constraint.cc (deduce_constrained_parameter): New.
116         Actually check that template arguments match the concept's 
117         parameters.
118         (deduce_constrained_parameter): Use deduce_constrained_parameter.
119         (make_constrained_auto): New. Construct an auto with an
120         attached constraint.
121         (check_*_constraint): Renamed to satisfy_*_constraint.
122         (satisfy_constraint): New. Simplify usage in evaluation functions.
123         (evaluate_constraints): New. Normalize and evaluate a constraint.
124         (constraints_satisfied_p): Allow a constraint to be used as
125         an argument in addition to declaraitons.
126         (constraint_expression_satisfied_p): Renamed from 
127         check_constraint_expression.
128         (diagnose_*): Use constraint_expression_satisfied_p.
129         (diagnose_decl_constraint): New.
130         (diagnose_constraint): Allow the argument to be a constraint
131         in addition to a declaration.
132         * gcc/testsuite/g++.dg/concepts/mem-concept.C: Renamed to
133         member-concept.C. Updated tests to reflect actual errors.
134         * gcc/testsuite/g++.dg/concepts/mem-concept-err.C: Removed,
135         because it is redundant.
136         * gcc/testsuite/g++.dg/concepts/var-concept5.C: Update error messages.
137         * gcc/testsuite/g++.dg/concepts/placeholder1.C: New.
139 2015-05-05  Andrew Sutton  <andrew.n.sutton@gmail.com>
141         Fixing errors in the invention of constrained placeholders
142         and bringing the implementation more into line with the
143         wording of the TS. Also, rewrite comments in C style.
144         * gcc/cp/cp-tree.def (INTRODUCED_PARM_DECL): Renamed to
145         WILDCARD_DECL.
146         * gcc/cp/cp-tree.h (INTRODUCED_PACK_P): Renamed to
147         WILDCARD_PACK_P.
148         (IS_INTRODUCED_PACK): Removed.
149         * cp-objcp-common.c (cp_common_init_ts): Use WILDCARD_DECL.
150         * gcc/cp/pt.c (convert_placeholder_argument): Renamed to
151         convert_wildcard_argument.
152         (coerce_template_parameter_pack): Update for removed macro.
153         gcc/cp/parser.c (cp_parser_introduction_list): Use WILDCARD_DECL.
154         (cp_maybe_constrained_type_specifier): Likewise.
155         (get_concept_from_constraint): Handle VAR_DECLs.
156         gcc/cp/constraint.cc (contains_wildcard_p): New.
157         (build_variable_check): New. Finish processing references to
158         variable templates if the template-id doesn't have wildcards.
159         (build_concept_check_arguments): New. Factor argument construction
160         into a separate function.
161         (build_template_id_check): New. Like build_concept_check, but
162         guarantees preservation of template-ids.
163         (build_concept_check): Use build_variable_check. Refacor to
164         use build_concept_check_arguments.
165         (process_introduction_parm): Use WILDCARD_DECL.
166         * gcc/testsuite/g++.dg/concepts/equiv2.C: Update test.
168 2015-05-04  Andrew Sutton  <andrew.n.sutton@gmail.com>
170         PR65854
171         * gcc/cp/parser.c (cp_parser_type_requirement): Unwrap alias 
172         declarations so they can be checked correctly.
173         * gcc/testsuite/g++.dg/concepts/pr65854.C: New.
175 2015-04-22  Andrew Sutton  <andrew.n.sutton@gmail.com>
177         PR65848
178         * gcc/cp/cp-tree.h (function_concept_check_p): New.
179         * gcc/cp/call.c (build_new_function_call): Don't evaluate
180         concepts while processing a template.
181         * gcc/cp/constraint.cc (function_concept_check_p): New.
182         * gcc/cp/pt.c (finish_template_variable): Don't evaluate
183         concepts while processing a template.
184         (instantiation_dependent_r): Treat all calls to function
185         concepts as instantiation dependent.
186         * gcc/testsuite/g++.dg/concepts/pr65848.C: New.
187         * gcc/testsuite/g++.dg/concepts/req4.C: Remove extra errors.
188         * gcc/testsuite/g++.dg/concepts/req5.C: Remove extra errors.
190 2015-04-22  Andrew Sutton  <andrew.n.sutton@gmail.com>
192         Compare constrained partial specializations structurally.
193         * gcc/pt.c (process_partial_specialization): Don't use a
194         canonical type for constrained partial template specializations.
195         Compare structurally to avoid ICE's when specializations resolve
196         differently.
198 2015-04-20  Andrew Sutton  <andrew.n.sutton@gmail.com>
200         PR65681
201         * gcc/cp/constraint.cc (tsubst_simple_requirement): Substitute
202         in a template-processing context to avoid doing full resolution
203         on types and expressions.
204         (tsubst_type_requirement): Likewise.
205         (tsubst_compound_requirement): Likewise.
206         (tsubst_nested_requirement): Likewise.
207         * gcc/testsuite/g++.dg/concepts/pr65681.C: New.
208         * gcc/testsuite/g++.dg/concepts/req2.C: Remove check for spurious
209         diagnostics.
211 2015-04-20  Andrew Sutton  <andrew.n.sutton@gmail.com>
213         Improve pretty printing output for constraints
214         * gcc/cp/error.c (dump_expr): Print predicate constraints
215         just like other constraints.
216         * gcc/cp/cxx-pretty-print.c (pp_cxx_requirement): Add missing
217         break statement.
218         (pp_cxx_requirement_list): Print requirements inline instead
219         of in newlines.
220         (pp_cxx_requirement_body): Don't print a parameter list if
221         there are no parameters.
222         (pp_cxx_nested_requirement): Be less obtuse.
223         (pp_cxx_expression_constraint): Likewise.
224         (pp_cxx_type_constraint) Likewise.
225         (pp_cxx_implicit_conversion_constraint): Likewise.
226         (pp_cxx_argument_deduction_constraint): Likewise.
227         (pp_cxx_parameterized_constraint): Likewise.
228         (pp_cxx_conjunction): Print spaces explicitly.
229         (pp_cxx_disjunction): Likewise.
231 2015-04-17  Andrew Sutton  <andrew.n.sutton@gmail.com>
233         Support requires-expressions for variable concepts.
234         * gcc/cp/parser.c (cp_parser_requires_expression): Parse
235         the parameters and body as unevaluated operands.
236         * gcc/cp/pt.c (value_dependent_expression_p): Make all
237         requires-expressions value dependent so we don't try to
238         initialize concepts as if they were actually variables.
239         * gcc/cp/tree.cp (cp_tree_equal): Remove debugging code.
240         * gcc/testsuite/g++.dg/concepts/var-concept1.C: Add tests
241         cases.
243 2015-04-14  Andrew Sutton  <andrew.n.sutton@gmail.com>
245         Fix bootstrap regression.
246         * gcc/cp/parser.c (cp_maybe_partial_concept_id): Remove
247         unused overload.
249 2015-04-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
251         Handle partial-concept-ids for variable templates
252         * gcc/cp/parser.c (cp_parser_template_id): Factor the check for
253         variable templates into a new branch that preceeds the check
254         for variable templates and function templates.
255         * gcc/testsuite/g++.dg/concepts/partial.C: Renamed.
256         * gcc/testsuite/g++.dg/concepts/partial-concept-id2.C: New.
258 2015-04-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
260         * gcc/cp/constraint.cc (lift_variable_concept): Coerce template
261         arguments before substituting into the initializer.
262         * gcc/cp/pt.c (coerce_template_parms): New overload that accepts
263         a tsubst_flags_t.
264         * gcc/cp/cp-tree.h (coerce_template_parms): New declaration.
265         * gcc/testsuite/g++.dg/concepts/var-concept5.C: New.
267 2015-04-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
268         
269         * gcc/cp/constriant.cc (check_pack_expansion): Don't check
270         same_type_p if the type is null.
271         * gcc/cp/pt.c (process_partial_specialization): Don't allow
272         specialization of variable concepts.
273         * gcc/testsuite/g++.dg/concepts/var-concepts[1-3].C: Renamed to
274         var-concept[1-3].C.
275         * gcc/testsuite/g++.dg/concepts/var-concept4.C: New.
277 2015-04-03  Andrew Sutton  <andrew.n.sutton@gmail.com>
278         
279         PR65635
280         * gcc/cp/tree.c (cp_tree_equal): Compare type declrations when
281         ordering constraints.
282         * gcc/testsuite/g++.dg/concepts/pr65635: New.
284 2015-04-03  Andrew Sutton  <andrew.n.sutton@gmail.com>
286         PR65636
287         * gcc/cp/pt.c (tsubst_decl): Don't try to manage specializations
288         for non-dependent, simple type declarations in namespace scope
289         because they don't have C++ language extensions.
290         * gcc/testsuite/g++.dg/concepts/pr65636: New.
292 2015-04-03  Andrew Sutton  <andrew.n.sutton@gmail.com>
294         PR65634
295         * gcc/cp/except.c (check_noexcept_r): Check the function type
296         and not the return type for (TYPE_NOTHROW_P).
297         * gcc/cp/parser.c (cp_parser_check_for_invalid_template_id): Remove
298         stray debugging code.
299         * gcc/testsuite/g++.dg/concepts/pr65634: New.
301 2015-04-02  Andrew Sutton  <andrew.n.sutton@gmail.com>
303         Fixing constraint processing bugs.
304         * gcc/cp/constraint.cc (check_logical_expr): Use build_x_binary_op
305         so that the c-common doesn't try to fold requires-expressions.
306         * gcc/cp/constexpr.c (cxx_eval_constant_expression): The value
307         of a requires clause is true iff its constraints are satisfied.
308         This lets us check negated requires-expressions.
309         * gcc/testsuite/g++.dg/concepts/req4.C: Update diagnostics
310         * gcc/testsuite/g++.dg/concepts/req5.C: Update diagnostics
311         * gcc/testsuite/g++.dg/concepts/req11.C: New.
313 2015-03-27  Andrew Sutton  <andrew.n.sutton@gmail.com>
314         
315         Trying again with PR65575.
316         * gcc/cp/parser.c (cp_parser_declarator): Search through
317         declarator structure for likely matches for function
318         declarations.
319         * gcc/testsuite/g++.dg/concepts/pr65575.C: Update with
320         new tests.
322 2015-03-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
323         
324         PR65575.
325         * gcc/cp/parser.c (cp_parser_declarator): Don't emit errors
326         when a trailing requires-clause follows a non-function
327         abstract declarator.
328         * gcc/testsuite/g++.dg/concepts/pr65575.C: New.
330 2015-03-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
332         Fix scope-squashing error in PR65552.
333         * gcc/cp/parser.C (cp_parser_type_requirement): Save and
334         restore scopes around optional nested name specifier parse.
335         * gcc/testsuite/g++.dg/concepts/pr65552.C: New.
337 2015-03-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
339         Fix bug in disjunction processing and fix the pretty
340         printing for __is_same_as trait correct.
341         * gcc/cp/constraint.cc (check_disjunction): Don't return
342         false if the first condition fails and the second succeeds.
343         * gcc/cp/cxx-pretty-print.c (pp_cxx_trait_expr): Print the
344         second argument for __is_same_as.
346 2015-03-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
348         Make implicit conversion constraints handle usual
349         conversions, not just implicit conversions.
350         * gcc/cp/constraint.cc (check_implicit_conversion_constraint): 
351         Use perform_direct_initialization_if_possible to test for
352         converibility instead of can_convert_arg.
353         * gcc/testsuite/g++.dg/concepts/req10.C: New.
355 2015-03-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
357         Suppress errors regarding deleted functions when
358         checking constriants
359         * gcc/cp/pt.c (tsubst_baselink): Pass complain flags to
360         mark_used.
361         * gcc/testsuite/g++.dg/concepts/expression3.C: New.
363 2015-03-22  Andrew Sutton  <andrew.n.sutton@gmail.com>
365         Fix regression related to variadic templates, bugs in
366         the handling of access checking, and in the logic solver.
367         * gcc/cp/constraint.cc (declare_constraint_vars): Mark
368         constraint variables.
369         (deferring_access_check_sentinel): Make this a local class
370         of check_expression_constraint.
371         (check_type_constraint): Don't defer access checks. Instead
372         pop deferred access checks if they fail.
373         (finish_requires_expr): Mark constraint variables.
374         * gcc/cp/cp-tree.h (CONSTRAINT_VAR_P): Indicates if a
375         parameter is a constraint variable.
376         * gcc/cp/pt.c (pending_expansion_p): New. Helps determine
377         if a parameter will be expanded during substitution.
378         (tsubst_pack_expansion): For certain expressions pending
379         expansion, do that here.
380         (tsubst_decl): Remove dead code.
381         (tsubst_copy_and_build): Don't add arguments that are
382         pending expansion. Also, don't build expansion when the
383         type is dependent. This was causing a regression in 
384         non-concepts code.
385         * gcc/cp/logic.cc (proof_state::branch): Don't rely on
386         order of operations. This crashed when built with Clang.
387         * gcc/testsuite/g++.dg/concepts/expression2.C: Update to
388         match diagnostics.
390 2015-03-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
392         Completely suppress access violations occurring from
393         constraint checks.
394         * gcc/cp/constraint.cc (deferring_access_check_sentinel): New helper
395         class for managing deferred access checks.
396         (check_expression_constraint): Explicitly defer constraint checks.
397         (check_type_constraint): Explicitly defer constraint checks.
398         * gcc/testsuite/g++.dg/concepts/expression3.C: New.
400 2015-03-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
402         Fail constraints due to access violations in non-SFINAE
403         contexts.
404         gcc/cp/constraint.cc (check_expression_constraint,
405         check_type_constraint): Check for access violations.
406         gcc/cp/pt.c (tsubst_decl): Make sure that template
407         info exists before dereferencing it.
408         * gcc/testsuite/g++.dg/concepts/expression2.C: New.
410 2015-03-20  Andrew Sutton  <andrew.n.sutton@gmail.com>
412         Fix grammar error type requirements and improve diagnostics
413         for mis-defined function concepts and errors involving pack 
414         expansions.
415         * gcc/cp/pt.c (determine_specialization). Remove dead code.
416         (lookup_template_class_1): Return an error if constraints
417         aren't satisfied.
418         * gcc/cp/constraint.cc (lift_function_definition): Don't
419         re-check for empty/erroneous concept definitions.
420         (lift_pack_expansion): Removed. Don't inline patterns so
421         that we can preserve the syntax beneath them.
422         (lift_expression): Don't do anything with pack expansions.
423         (check_function_concept): Specifically check for empty
424         concept definitions.
425         (diagnose_pack_expansion): Diagnose errors in expansions
426         more thoughtfully by determining which arguments are failing
427         their expanded requirements.
428         gcc/cp/parser.c (cp_parser_type_requirement): Accept an
429         optional template keyword before a template-id and
430         parse that as a special case of required type name.
431         gcc/testsuite/g++.dg/concepts/template-parm11.C: Update test
432         for fixed grammar, diagnostics.
434 2015-03-20  Andrew Sutton  <andrew.n.sutton@gmail.com>
436         Ensure that empty expansions are satisfied.
437         * gcc/cp/constraint.cc (check_pack_expansion): Empty expansions
438         are satsified.
439         * gcc/testsuite/g++.dg/concepts/template-parm11.C: New.
441 2015-03-20  Andrew Sutton  <andrew.n.sutton@gmail.com>
443         Fix regression in variadic constraint processing.
444         * gcc/cp/pt.c (tsubst_pack_expansion): Expose declaration.
445         * gcc/cp/constraint.cc: Rename lift_constraints to
446         lift_expression to better reflect what it does.
447         (lift_pack_expansion): New. Handles naked pack expansions
448         in a constriant.
449         (check_pack_expansion): Special handling for checking naked
450         pack expansions in constraints. This eventually be replaced
451         by similar logic for fold expressions.
452         (check_predicate_constraint): Handle pack expansions.
453         * gcc/cp/cp-tree.h (tsubst_pack_expansion): Make this avaialble
454         to constraints.cc.
456 2015-03-18  Andrew Sutton  <andrew.n.sutton@gmail.com>
458         Update variable concept processing to account for changes
459         in variable template syntax.
460         * gcc/cp/constraint.cc (valid_predicate_p): Remove because of
461         frequent triggers.
462         (make_predicate_constraint): Likewise.
463         (lift_function_call): Check for use of variables in function
464         calls in constraints.
465         (lift_call_expression): Renamed from lift_call. Specifically
466         check function calls before rewriting the node.
467         (lift_variable_concept). Renamed from lift_var. Remove redundant
468         check for concepts.
469         (lift_variable). New. Accommodates new processing rules for
470         variable templates.
471         (lift_constraints). Add variable decls to the switch.
472         * gcc/cp/pt.c (finish_variable_template): Don't evaluate
473         for dependent template arguments.
474         (remove_constraints): Remove debugging code.
475         * gcc/testsuite/g++.dg/concepts/var-concepts1.C: Separate out
476         failing test into equiv2.C.
477         * gcc/testsuite/g++.dg/concepts/var-concepts1.C: Update error
478         messages.
479         * gcc/testsuite/g++.dg/concepts/equiv2.C: New.
481 2015-03-18  Andrew Sutton  <andrew.n.sutton@gmail.com>
482         
483         Addressing regressions after merge.
484         * gcc/cp/parser.c (cp_parser_template_declaration_after_export):
485         Revert implementation of concept introductions. It was causing
486         scoping issues.
487         * gcc/testsuite/g++.dg/concepts/friend1.C: Update test to account
488         for apparent fix (?) to lookup rules involving friends.
490 2015-03-03  Andrew Sutton  <andrew.n.sutton@gmail.com>
492         Rewrite to use new constraint model.
493         * gcc/cp/call.c (add_function_candidate): Use new constraint
494         checking interface.
495         (build_new_function_call): Evaluate concepts when selected
496         by overload resolution.
497         * gcc/cp/class.c (resolve_address_of_overloaded_function):
498         Use new constraint interface.
499         * gcc/cp/constexpr.c (cxx_eval_constant_expression): Don't 
500         try to constexpr evaluate a requires-expression.
501         (potential_constant_expression_1): Stop using old
502         requires/constraint features.
503         gcc/cp/constraint.cc: Much rewriting, reorganization, refactoring
504         to support new constraint/requirement terms.
505         (lift_function_definition): New. Factor lifting code out of
506         lift_call for reuse in evaluate_function_concept.
507         (lift_variable_intializer): New. Factor lifting code out of
508         lift_var for reuse in evaluate_variable_concept.
509         (lift_template_id): Restore checking code for mis-written
510         variable concepts.
511         (lift_requires_expr): Handle these separately.
512         (xform_*_requirement): New. Transform requires-expressions
513         into constraints.
514         (get/set/remove_constraints, decl_constraints): Move to
515         pt.c to allow for garbage collection.
516         (processing_constraint): Kill this global.
517         (diagnose_*): Update diagnostics to use the new constraint
518         interface.
519         * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Remove typing
520         of old nodes.
521         * gcc/cp/cp-tree.def: Add new nodes for requirements and
522         constraints. Remove previous constraint/req nodes.
523         gcc/cp/cp-tree.h (COMPOUND_REQ_NOEXCEPT_P): New.
524         (ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE): Fix operands.
525         (constraint_p, make_predicate_constraint_p, valid_constraints_p): New.
526         (misc): Remove unused declarations.
527         gcc/cp/cxx-pretty-print.c: Reorganize/rewrite for new constraint
528         model.
529         (primary_expression, expression): Remove unused nodes, add options 
530         for constraints
531         gcc/cp/cxx-pretty-print.h: Declare new functions for pretty
532         printing.
533         gcc/cp/decl.c (duplicate_decls): Only reclaim when flag_concepts
534         is on.
535         (grokfndecl): Associate predicate constraints.
536         gcc/cp/decl2.c (mark_used): Don't instantiate concepts.
537         gcc/cp/error.c (dump_expr): Handle new constraints.
538         gcc/cp/method.c (implicitly_declare_fn): Use new constraint
539         interface.
540         gcc/cp/parser.c (make_call_declarator): Pass a requires-clause for
541         call declarators.
542         (cp_parser_type_name): Take a flag to indicate the presence of
543         a pre-parsed 'typename'.
544         (cp_parser_requires_expression): Move sentinel into function.
545         (cp_parser_type_requirement): Parse type requirements in accordance
546         with Concepts TS.
547         (cp_parser_compound_requirement): Parse compound requirements in
548         accordance with Concepts TS. Remove constexpr requirements.
549         (cp_parser_template_declaration_after_export): Associate
550         predicate constraints.
551         gcc/cp/pt.c (get_template_for_ordering): New. Extract a template
552         decl from a list of candidates.
553         (lookup_template_class_1): Use new constraint interface.
554         (tsubst_pack_conjunction): Build an expression, not constraints.
555         (tsubst_decl): Only associate constraints when substituting
556         through members.
557         (tsubst): Kill subst rules for old nodes.
558         (most_specialized_partial_spec): Save candidates correctly
559         in the presence of constraints.
560         (always_instantiate_p): Never always instantiate a concept.
561         (type_dependent_expression_p): Requires expressions have type bool.
562         (decl_constraints): Moved from constraint.cc, use hash_table
563         instead of hash_map.
564         gcc/cp/semantics.c (finish_call_expr): Remove constraints from
565         functions, not overload sets.
566         (finish_template_variable): Evaluate variable concepts by
567         determining satisfaction.
568         gcc/cp/typeck.c (cp_build_function_call_vec): Use new concept 
569         interface.
570         gcc/cp/testsuite/g++.dg/concepts/*: Update tests to match syntax,
571         diagnostics.
572         gcc/cp/testsuite/g++.dg/concepts/req1.C: Test requires-expression
573         with no parens.
575 2015-02-25  Braden Obrzut  <admin@maniacsvault.net>
577         * gcc/cp/constraint.cc (lift_operands): New.
578         (lift_call): Lift operands on function calls and don't use
579         tsubst_constraint_expr.
580         (lift_var): Don't use tsubst_constraint_expr.
581         (lift_constraints): Use the returned number of operands for most nodes
582         and also lift from TREE_LISTs.
584 2015-02-17  Braden Obrzut  <admin@maniacsvault.net>
586         * gcc/cp/constraint.cc (lift_call): Converted from normalize_call.
587         (lift_var): Converted from normalize_var.
588         (lift_template_id): Converted from normalize_template_id.
589         (lift_constraints): Implemented.
591 2015-02-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
593         * gcc/cp/cp-tree.h: (EXPR_CONSTR_EXPR, TYPE_CONSTR_TYPE): Fix 
594         typos in macro names.
595         * gcc/cp/constraint.cc: (check_constraint*): New. Rewrite the
596         constraint checking implementation so that it matches the
597         wording and rules in n4377.
599 2015-02-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
601         * gcc/cp/logic.cc: Rewrite to use new constraint model and
602         update formatting.
603         * gcc/cp/constraint.cc: Documentation and organization.
605 2015-02-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
607         * gcc/cp/cp-tree.h (is_constraint): Make static.
609 2015-02-09  Andrew Sutton  <andrew.n.sutton@gmail.com>
611         Rewrite normalization in terms of constraints.
612         * gcc/cp/cp-tree.h (is_constraint): New.
613         * gcc/cp/constraint.cc (normalize_*): Rewrite the previous normalization
614         model so that it conforms with the specification. Normalization applies
615         to constraints. Transformation of expressions into constraints now
616         happens in two phases: lifting concept definitions, and the actual
617         transformation.
618         (tranform_expression, xform_*): New. Define transformation of 
619         expressions into constraints.
620         (lift_constraints): New. Stubbed out inlining function.
622 2015-02-09  Andrew Sutton  <andrew.n.sutton@gmail.com>
624         Start refactoring constraints to match the specification.
625         * gcc/cp/cp-tree.def: Add new TREECODEs for constraints.
626         * gcc/cp/cp-tree.h: Add accessor macros for constraint operands.
628 2015-02-05  Braden Obrzut  <admin@maniacsvault.net>
630         * gcc/cp/constexpr.c (potential_constant_expression_1): Readded missing
631         cases from previous merge from trunk.
632         * gcc/cp/cxx-pretty-print.c (pp_cxx_trait_expression): Restored
633         CPTK_IS_CONVERTIBLE_TO for the time being since the constraint code
634         relies on it.
635         * gcc/cp/semantics.c (finish_trait_expr): Likewise.
636         * gcc/testsuite/g++.dg/concepts/req9.C: New test.
638 2015-02-03  Braden Obrzut  <admin@maniacsvault.net>
640         * gcc/cp/class.c (build_clone): Clone constraints.
641         * gcc/cp/constraint.cc (normalize_atom): Update diagnostic.
642         (normalize_constraints): Return error_mark_node if normalization fails.
643         (get_constraints): Access constraints through hash map.
644         (set_constraints): Set constraints through hash map.
645         (remove_constraints): Access constraints through hash map.
646         (associate_classtype_constraints): New.
647         (init_leading_requirements): Removed.
648         (init_trailing_requirements): Removed.
649         (update_leadng_requirements): Removed.
650         (update_trailing_requirements): Removed.
651         (save_leading_constraints): Removed.
652         (save_trailing_constraints): Removed.
653         (finish_template_constraints): Removed.
654         (build_constraints): New. Builds CONSTRAINT_INFO from requirements.
655         (finish_concept_introduction): Check generated parameters for errors.
656         (tsubst_constraint_info): Update implementation.
657         (equivalent_constraints): Check input types.
658         (subsumes_constraints): Update implementation.
659         (at_least_as_constrained): New. Check if a decl's constraints subsumes
660         another.
661         (diagnose_constraints): Temporarily simplify diagnostics.
662         * gcc/cp/cp-tree.h (tree_constraint_info): Refactor the way constraints
663         are stored.
664         (CI_TEMPLATE_REQS): Renamed from CI_LEADING_REQS.
665         (CI_DECLARATOR_REQS): Renamed from CI_TRAILING_REQS.
666         (CI_ASSOCIATED_CONSTRAINTS): New.
667         (CI_NORMALIZED_CONSTRAINTS): New.
668         (CI_ASSOCIATED_REQS): Removed.
669         (saved_scope): Save template requirements.
670         (current_template_reqs): Removed.
671         (lang_decl_min): Replace requires_clause (trailing requirements) with
672         more generic constraint_info.
673         * gcc/cp/cxx-pretty-print.c (cxx_pretty_printer::declarator): Print
674         requires clause.
675         (pp_cxx_function_definition): Moved requires clause printing to above.
676         (pp_cxx_init_declarator): Likewise.
677         (pp_cxx_template_declaration): Update implementation to get
678         requirements from CONSTRAINT_INFO.
679         * gcc/cp/decl.c (duplicate_decls): Remove constraints before reclaiming
680         memory.
681         (is_class_template_or_specialization): New.
682         (get_leading_constraints): Removed.
683         (adjust_fn_constraints): Removed.
684         (grokfndecl): Update implementation to other changes.
685         (get_trailing_requires_clause): New.
686         (grokdeclarator): Pass trailing requires clause to grokfndecl.
687         (xref_tag_1): Check overload constraints.
688         * gcc/cp/error.c (dump_template_decl): Print requires clause.
689         (dump_function_decl): Update implementation for accessing requirements.
690         * gcc/cp/logic.cc (subsumes_constraints_nonnull): Update
691         CI_ASSOCIATED_REQS usage.
692         * gcc/cp/method.c (implicitly_declare_fn): Copy constraints of
693         inherited constructors.
694         * gcc/cp/parser.c (cp_parser_lambda_expression): Remove now unneeded
695         template requirements saving.
696         (cp_parser_type_parameter): Likewise.
697         (cp_parser_template_argument_list): Unwrap template_template_parms when
698         produced by short hand notation with function concepts.
699         (cp_parser_alias_declaration): Attach constraints to aliases.
700         (cp_manage_requirements): Removed.
701         (cp_parser_trailing_requirements_clause): Renamed from
702         cp_parser_trailing_requirements.
703         (cp_parser_init_declarator): Removed now unneeded requirements saving.
704         (cp_parser_basic_declarator): Separated from cp_parser_declarator.
705         (cp_parser_declarator): Parses trailing requires clause if
706         cp_parser_basic_declarator succeeds.
707         (cp_parser_class_specifier_1): Associate constaints with type.
708         (cp_parser_member_declaration): Remove unneeded template requirement
709         saving.
710         (cp_parser_template_declaration_after_export): Likewise.
711         (cp_parser_single_declaration): Associate constraints.
712         (cp_parser_late_parsing_for_member): Remove unneeded template
713         requirement saving.
714         (synthesize_implicit_template_parm): Likewise.
715         * gcc/cp/pt.c (maybe_new_partial_specialization): Update
716         implementation.
717         (process_template_parm): Removed unneeded template requirement saving.
718         (build_template_decl): Handle constraints.
719         (process_partial_specialization): Update constraint access and check
720         that specialization is more specialized.
721         (push_template_decl_real): Update constraint access.
722         (add_inherited_template_parms): Removed constraint handling.
723         (tsubst_pack_conjuction): Update implemenation.
724         (tsubst_decl): Changed constraint propagation.
725         (more_specialized_fn): Update constraint access.
726         (most_specialized_partial_spec): Update constraint access.
727         * gcc/cp/ptree.c (cxx_print_xnode): Update constraint access.
728         * gcc/cp/semantics.c (finish_call_expr): Remove constraints.
729         (finish_template_template_parm): Update constraint access.
730         * gcc/testsuite/g++.dg/concepts/alias4.C: Mark xfail.
731         * gcc/testsuite/g++.dg/concepts/class.C: Check for escape hatch.
732         * gcc/testsuite/g++.dg/concepts/class6.C: Added diagnostic.
733         * gcc/testsuite/g++.dg/concepts/inherit-ctor1.C: Improved test case.
734         * gcc/testsuite/g++.dg/concepts/inherit-ctor2.C: Updated diagnostic.
735         * gcc/testsuite/g++.dg/concepts/inherit-ctor4.C: Updated diagnostic.
736         * gcc/testsuite/g++.dg/concepts/intro4.C: Updated diagnostics.
737         * gcc/testsuite/g++.dg/concepts/req4.C: Updated diagnostic.
738         * gcc/testsuite/g++.dg/concepts/req5.C: Updated diagnostic.
740 2014-12-29  Jason Merrill  <jason@redhat.com>
742         * gcc/cp/pt.c (type_dependent_expression_p): Remove obsolete use of
743         PLACEHOLDER_EXPR.
744         (convert_template_argument): Likewise.
746 2014-11-15  Braden Obrzut  <admin@maniacsvault.net>
748         * gcc/cp/constraint.cc (resolve_constraint_check): Move definition
749         check to grokfndecl.
750         (normalize_template_id): Use expression location if available when
751         informing about missing parentheses.
752         (build_requires_expr): Added comment.
753         (diagnose_var): Clarified comment.
754         * gcc/cp/decl.c (check_concept_refinement): Remove outdated comment
755         regarding variable concepts.
756         (grokfndecl): Ensure that all concept declarations are definitions.
757         (grokdeclarator): Remove outdated comment regarding variable concepts.
758         * gcc/cp/parser.c (cp_parser_introduction_list): Use vec for temporary
759         list instead of a TREE_LIST.
760         (get_id_declarator): Renamed from cp_get_id_declarator.
761         (get_unqualified_id): Renamed from cp_get_identifier.
762         (is_constrained_parameter): Renamed from cp_is_constrained_parameter.
763         (cp_parser_check_constrained_type_parm): Renamed from
764         cp_check_constrained_type_parm.
765         (cp_parser_constrained_type_template_parm): Renamed from
766         cp_constrained_type_template_parm.
767         (cp_parser_constrained_template_template_parm): Renamed from
768         cp_constrained_template_template_parm.
769         (constrained_non_type_template_parm): Renamed from
770         cp_constrained_non_type_tmeplate_parm.
771         (finish_constrained_parameter): Renamed from
772         cp_finish_constrained_parameter.
773         (maybe_type_parameter): Renamed from cp_maybe_type_parameter.
774         (declares_type_parameter): Renamed from cp_declares_type_parameter.
775         (declares_type_template_parameter): Renamed from
776         cp_declares_type_template_parameter.
777         (declares_template_template_parameter): Renamed from
778         cp_declares_template_template_parameter.
779         (cp_parser_type_parameter): Call
780         cp_parser_default_type_template_argument and
781         cp_parser_default_template_template_argument which were already
782         factored out from this function.
783         (cp_maybe_constrained_type_specifier): Use the new INTRODUCED_PARM_DECL
784         instead of PLACEHOLDER_EXPR.
785         (cp_parser_requires_expr_scope): Remove old comment and change
786         destructor to use pop_bindings_and_leave_scope.
787         (cp_parser_requires_expression): Remove old comment.
788         (get_concept_from_constraint): Remove old comment.
789         * gcc/testsuite/g++.dg/concepts/decl-diagnose.C: Changed expected
790         errors now that missing concept definitions are diagnosed earlier.
792 2014-11-11  Jason Merrill  <jason@redhat.com>
794         * gcc/cp/call.c (add_function_candidate): Move constraint check after
795         arity check.
797         * gcc/cp/class.c (get_member_fn_template)
798         (are_constrained_member_overloads): Remove.
799         (add_method): Call equivalently_constrained directly.
801 2014-11-03  Jason Merrill  <jason@redhat.com>
803         * gcc/cp/parser.c (cp_parser_nonclass_name): Fix merge error.
805 2014-10-20  Andrew Sutton  <andrew.n.sutton@gmail.com>
807         Fixing user-reported issues and regressions
808         * gcc/cp/parser.c (cp_parser_template_declaration_after_exp):
809         Only pop access checks on failed parsing.
810         * gcc/cp/pt.c (type_dependent_expr_p): Always treat a 
811         requires-expr as if dependently typed. Otherwise, we try to
812         evaluate these expressions when they have dependent types.
813         * gcc/cp/constriant.cc (normalize_stmt_list): Remove unused
814         function.
815         (normalize_call): Don't fold constraints during normalization.
816         * gcc/testsuite/g++.dg/concepts/decl-diagnose.C: Update diagnostics.
818 2014-10-20  Andrew Sutton  <andrew.n.sutton@gmail.com>
820                                 Fix another introduction regression.
821                                 * gcc/cp/parser.c (cp_parser_template_declaration_after_exp):
822                                 Only pop access checks on failed parsing.
824 2014-10-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
826         Fix regression related to concept introductions.
827         * gcc/cp/parser.c (cp_parser_template_declaration_after_exp):
828         Pop deferred access checks afer parsing the introduction.
830 2014-10-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
832         Fix bug related to cleanup expressions in concept definitions.
833         * gcc/cp/constraint.cc (check_function_concept): See through
834         cleanup handlers when checking the body of a function.
835         (normalize_cast): Removed. Handled in a default case.
836         (normalize_cleanup_point): New. Normalize the expression without
837         the cleanup handler.
839 2014-09-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
841         Explicitly disallow function concepts with deduced return types.
842         * gcc/cp/constraint.cc (check_function_concept): Remove check
843         for deduced return type.
844         * gcc/cp/decl.c (check_concept_fn): Explicitly check for
845         deduced return type.
846         * gcc/testsuite/g++.dg/concepts/fn-concept2.C: New.
848 2014-09-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
850         Check requirements on function concept definitions.
851         * gcc/cp/decl.c (finish_function): Check properties of a function
852         concept definition.
853         * gcc/cp/constraint.cc (check_function_concept): New. Check
854         for deduced return type and multiple statements.
855         (normalize_misc): Don't normalize multiple statements.
856         (normalize_stmt_list): Removed.
857         * gcc/cp/cp-tree.h (check_function_concept): New.
858         * gcc/testsuite/g++.dg/concepts/fn-concept1.C: New.
860 2014-09-04  Braden Obrzut  <admin@maniacsvault.net>
862         Implement concept introductions.
863         * gcc/cp/constraint.cc (deduce_concept_introduction): New.
864         (build_concept_check): Allow arg to be NULL to skip placeholder.
865         (process_introduction_parm): New.
866         (finish_concept_introduction): New.
867         * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Mark introduced parm.
868         * gcc/cp/cp-tree.def: New INTRODUCED_PARM_DECL.
869         * gcc/cp/parser.c (cp_parser_declaration): Tentatively parse for
870         concept introduction.
871         (cp_parser_introduction_list): New.
872         (cp_parser_member_declaration): Tentatively parse for concept
873         introduction.
874         (cp_parser_template_introduction): New.
875         (cp_parser_template_declaration_after_export): Parse concept
876         introductions.
877         * gcc/cp/pt.c (convert_template_argument): Treat INTRODUCED_PARM_DECL
878         as a placeholder.
879         (coerce_template_parms): If INTRODUCED_PARM_DECL represents a pack then
880         match the entire parameter pack of the template.
881         (type_dependent_expression_p): Treat INTRODUCED_PARM_DECL as a
882         placeholder.
883         * gcc/testsuite/g++.dg/concepts/introduction1.C: New.
884         * gcc/testsuite/g++.dg/concepts/introduction2.C: New.
885         * gcc/testsuite/g++.dg/concepts/introduction3.C: New.
886         * gcc/testsuite/g++.dg/concepts/introduction4.C: New.
887         * gcc/testsuite/g++.dg/concepts/introduction5.C: New.
889 2014-09-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
891         Fixing normalization in the presence of constructor calls.
892         * gcc/cp/constraint.cc (normalize_misc): Handle constructor
893         expressions.
894         * gcc/testsuite/g++.dg/concepts/req7.C: New.
896 2014-08-29  Andrew Sutton  <andrew.n.sutton@gmail.com>
898         Fixing partial-template-id bug.
899         * gcc/cp/parser.c (cp_parser_type_name): If the returned type-decl
900         is actually a shorthand declaration, don't simulate an error.
901         * gcc/testsuite/g++.dg/concepts/template-parm10.C: New.
903 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
905         Add tests for constrained friends.
906         * gcc/testsuite/g++.dg/concepts/friend1.C: New.
907         * gcc/testsuite/g++.dg/concepts/friend2.C: New.
909 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
911         * gcc/cp/decl.c (is_concept_var): Coding style fix.
913 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
915         Fixing regression in scoping rules for templates.
916         * gcc/cp/semantics.c (fixup_tmeplate_type): Lift check to
917         finish_template_type.
918         (finish_template_type): Only do this when concepts are enabled,
919         and also when the class is actually a template. For non-dependent
920         types there are no actions to be taken.
922 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
924         Additional declaration restrictions on variable concepts.
925         * gcc/cp/decl.c (is_concept_var): New.
926         (cp_finish_decl): Check for uninitialized variable
927         concepts.
928         (grokvardecl): Don't set the concept flag for non-template variables.
929         * g++.dg/concepts/decl-diagnose.C: Add tests.
931 2014-08-19  Ville Voutilainen  <ville.voutilainen@gmail.com>
933         Ban static member function concepts.
934         * gcc/cp/decl.c (grokdeclarator): Diagnose static member function 
935         concepts.
936         * g++.dg/concepts/decl-diagnose.C: Adjust.
937         * g++.dg/concepts/mem-concept-err.C: Adjust.
938         * g++.dg/concepts/mem-concept.C: Adjust.
940 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
942         Fixes to variable concept implementation.
943         * gcc/cp/cp-tree.h (variable_concept_p): New.
944         * gcc/cp/parser.c (cp_parser_nonclass_name): Check for concepts,
945         not just templates.
946         * gcc/cp/decl.c (grokvardecl): Label concepts as concepts.
947         * gcc/cp/constraint.cc (check_call): New.
948         (normalize_call): Ensure that calls are probably to functions.
949         (normalize_template_id): Update diagnostics.
950         (finish_template_constraints): Mark assumptions as an error if
951         constraint normalization fails. This was causing normalization
952         to be run twice during the construction of a single declaration.
953         * gcc/testsuite/g++.dg/concepts: Update tests.
955 2014-08-14  Andrew Sutton  <andrew.n.sutton@gmail.com>
957         Fix regression.
958         * gcc/cp/pt.c (value_dependent_expression_p): Don't assume
959         that all nodes have operands.
961 2014-08-14  Andrew Sutton  <andrew.n.sutton@gmail.com>
963         Implement normalization checks.
964         * gcc/cp/constraint.cc (normalize_expr): Delegate cast and
965         atomic nodes to a dedicated function.
966         (check_logical): Check that an && or || does not resolve to a
967         user-defined function.
968         (normalize_logical): Check operators and save the locaiton of
969         the new expression.
970         (normalize_call, normalize_var): Remove spurios error messages.
971         (normalize_cast): New, delegates to normalize atom.
972         (normalize_atom): Check that instantiated expressions can be
973         converted to bool
974         (tsubst_constraint_info): Re-normalize the associated constraints
975         to check for post-substitution restrictions.
976         * gcc/cp/cp-tree.h (xvalue_result_type): Add to header.
978 2014-08-14  Andrew Sutton  <andrew.n.sutton@gmail.com>
980         * gcc/testsuite/g++.dg/concepts: Renamed ttp* to template-parm*,
981         and fixed them.
983 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
985         * gcc/cp/class.c (resolve_address_of_overloaded_function): Check
986         constraints.
987         * gcc/cp/decl.c (grokfndecl): For now, disallow constrained
988         non-template functions.
989         * gcc/testsuite/g++.dg/concepts: New tests.
991 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
993         * gcc/cp/parser.c (get_id_declarator, get_identifier): New helper
994         functions.s
995         (cp_check_constrained_type_parm): Don't fail on null declarators.
996         (cp_finish_constrained_parameter): Remove redundant processing for
997         checking declarations.
998         (cp_maybe_type_parameter, cp_declares_type_parameter, 
999         cp_declares_type_template_parameter, 
1000         cp_declares_template_template_parameter): New helper functions for
1001         determining when a parameter declaration is actually a constrained
1002         template parameter.
1003         (cp_parser_default_type_template_argument, 
1004         cp_parser_default_template_template_argument): Parsing support
1005         for argument types of default arguments.
1006         (cp_parser_template_parameter): Finish constrained parameters
1007         after all variadic and default arg checks.
1008         (cp_parser_parameter_declaration): Parse default arguments
1009         differently if the parameter actually declares a type parameter.
1010         * gcc/testsuite/g++.dg/concepts: New tests.
1012 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
1014         * gcc/testsuite/g++.dg/concepts/explicit-spec6.C: New test.
1016 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
1018         Fix regression in bootstrap.
1019         * gcc/cp/call.c (get_temploid): Removed. No longer called.
1020         (joust): Remove unused variable declarations.
1022 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
1023         
1024         Implement deduction-based explicit instantiation and specialization.
1025         * gcc/cp/call.c (joust): Allow all non-templates to be ordered by
1026         constraints.
1027         * gcc/cp/pt.c (get_class_bindings): Remove superfluous parameter and
1028         move constraint check into most_specialized_class.
1029         (most_constrained_function): Order functions with the same signatures
1030         by their constraints.
1031         (determine_specialization): Candidates must satisfy constraints. Also,
1032         order non-template candidates by constraints. Improve diagnostics
1033         for instances where candidates are rejected.
1034         (more_specialized_inst): New. Compare function templates.
1035         (most_specialized_instantiation): Refactor to use 
1036         more_specialized_inst and order by constraints.
1037         (most_specialized_class): Candidates must satisfy constraints.
1038         * gcc/cp/decl.c (various) Cosmetic fixes.
1039         (adjust_fn_constraints): Rewrite so that class template constraints
1040         are not imposed on member function declarations.
1041         * gcc/testsuite/g++.dg/concepts: New tests.
1043 2014-08-13  Braden Obrzut <admin@maniacsvault.net>
1045         * gcc/cp/constraint.cc (deduce_constrained_parameter): Deduce concept
1046         from variable concept template-id expressions.
1047         (normalize_var): New.
1048         (normalize_template_id): Identify variable concepts.
1049         (build_concept_check): Handle variable concepts.
1050         (finish_shorthand_requirement): Handle variable concepts.
1051         (diagnose_var): New.
1052         (diagnose_node): Identify variable concepts.
1053         * gcc/cp/decl.c (grokvardecl): Pass concept flag through to
1054         check_explicit_specialization.
1055         (grokdeclarator): Allow variable concepts and pass concept flag through
1056         grokvardecl.
1057         * gcc/cp/parser.c (cp_is_constrained_parameter): Accept variable
1058         concepts.
1059         (cp_parser_nonclass_name): Accept variable concepts.
1060         (get_concept_from_constraint): Handle variable concepts.
1061         * gcc/cp/pt.c (tsubst_copy_and_build): Lookup variable templates.
1062         (value_dependent_expression_p): Check requires expressions for value
1063         dependence.
1064         * gcc/cp/semantics.c (finish_call_expr): Don't instantiate variable
1065         templates if processing a template declaration.
1066         * gcc/testsuite/g++.dg/concepts/decl-diagnose.C: Change expected error
1067         as variable concepts are now handled.
1068         * gcc/testsuite/g++.dg/concepts/var-concepts1.C: New test.
1069         * gcc/testsuite/g++.dg/concepts/var-concepts2.C: New test.
1071 2014-08-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
1072         
1073         * gcc/cp/pt.c (tsubst): Don't short circuit substitution into
1074         types when processing constraints. Also, avoid asserting when
1075         substituting into template parameters.
1076         * gcc/cp/constraint.c (tsubst_constraint_expr): Indicate that
1077         constraint processing is happening.
1078         (tsubst_constraint_info): Just substitute directly into the
1079         normalized constraints instead of re-normalizing.
1080         (diagnose_constraints): Adjust template arguments when
1081         diagnosing template constraint failures.
1082         * gcc/cp/logic.cc (decompose_assumptions): Handle null assumptions.
1084 2014-08-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
1085         
1086         * gcc/cp/logic.cc (subsumes_constraints_nonnull): Don't re-normalize
1087         constraints, it's already been done.
1088         * gcc/cp/cp-tree.h (*_requirement[s]): Renamed to *_constraint[s] to
1089         reflect wording in specification. Removed reduce_requirements.
1090         * gcc/cp/pt.c (process_template_parm, tsubst_pack_conjunction): Update 
1091         from renaming.
1092         (fn_type_unification): Remove constraint check.
1093         * gcc/cp/parser.c (cp_parser_type_parameter, 
1094         cp_parser_trailing_requirements, 
1095         cp_parser_template_declaration_after_export,
1096         synthesize_implicit_template_parm): Update from renaming.
1097         * gcc/cp/constraint.cc: Renamed a lot of functions to reflect wording
1098         in specification.
1099         (finish_template_constraints): Normalize associated constraints.
1100         (tsubst_constraint_expr): Renamed from instantiate_requirements.
1101         Normalize associated constraints.
1102         (check_satisfied): Return true if the arguments refer to template
1103         parameters.
1104         (all_constraints_satisfied, any_conjunctions_satisfied,
1105         check_requirements): No longer needed.
1106         (check_diagnostic_constraints): Just normalize the expression, don't
1107         decompose it.
1109 2014-08-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
1111         * gcc/testsuite/g++.dg/concepts/concepts.exp: Add missing argument
1112         to g++-dg-runtest.
1114 2014-08-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
1116         * gcc/cp/constraints.c (tsubst_requires_body, instantiate_requirements):
1117         Lift the unevaluated operand guard to the entire constraint expression.
1118         (check_satisfied, all_constraints_satisfied, 
1119         any_conjunctions_satisfied): Rewrite constraint checking to use
1120         atomic constraints. Prevents instantiation of concepts.
1121         (check_diagnostic_constraints): Recursively decompose and check
1122         constraints for fine-grain diagnostics.
1123         (diagnose_*): Use new constraint checking function.
1124         
1126 2014-07-30  Braden Obrzut  <admin@maniacsvault.net>
1127         
1128         * gcc/cp/parser.c (cp_parser_trailing_requirements): Handle requires
1129         keyword manually so that we can push function parameters back into
1130         scope.
1131         * gcc/cp/decl.c (push_function_parms): New. Recovers and reopens
1132         function parameter scope from declarator.
1133         * gcc/testsuite/g++.dg/concepts/req*.C: New tests.
1135 2014-07-30  Andrew Sutton  <andrew.n.sutton@gmail.com>
1136         
1137         * gcc/testsuite/g++.dg/concepts/test.C: Removed.
1139 2014-07-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
1140         
1141         * gcc/cp/cp-tree.h (more_constraints): Remove
1142         (subsumes_constraints): Renamed from more_constraints
1143         (more_constrained): Repurposed
1144         * gcc/cp/call-c (template_decl_for_candidates): Rename to get_temploid,
1145         only get template info for member functions of a class template
1146         specialization.
1147         (joust): Handle member functions of class template specializations
1148         separately from function templates. This matches the new wording in
1149         the TS.
1150         * gcc/cp/logic.cc (match_terms): Make inline.
1151         (subsumes_constraints): Rename to subsumes_constraints_nonnull.
1152         * gcc/cp/pt.c (is_compatible_template_arg): Use subsumes.
1153         (more_specialized_fn): Use usubsumes_constraints.
1154         (more_specialized_class): Use more_constrained.
1155         * gcc/cp/constraint.cc (more_constraints): Removed.
1156         (more_constrained): New.
1158 2014-07-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
1159         
1160         * gcc/cp/typeck.c (cp_build_function_call_vec): Emit diagnostic
1161         at the input location.
1162         * gcc/cp/error.c (dump_template_decl): Constraints are never invalid
1163         in this way. Also fixes brace warning.
1165 2014-07-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
1166         
1167         * gcc/cp/tree.c (cp_tree_equal): compare constraint infos by
1168         their associated constraints (patch by Braden Obrzut).
1169         * gcc/cp/logic.c (decompose_assumptions): Don't decompose errors.
1170         (subsumes_constraints): Update to use new macros.
1171         * gcc/cp/cp-tree.h (tree_constraint_info): Rewrite constraints
1172         to cache leading, trailing, and associated requirements.
1173         (CI_SPELLING, CI_REQUIREMENTS): Remove
1174         (CL_LEADING_REQS, CI_TRAILING_REQS, CI_ASSOCIATED_REQS): New
1175         accessors for constraint info field.
1176         (save_leading_requirements, save_trailing_requirements,
1177         valid_template_requirements_p): New.
1178         (make_constraints): Removed.
1179         (instantiate_requirements): Add flag to substitute in either
1180         dependent/non-dependent mode.
1181         (tsubst_constraint_info): New.
1182         * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_clause): New.
1183         * gcc/cp/cxx-pretty-print.c (pp_cxx_init_declarator): Remove.
1184         (pp_cxx_function_definition): Print trailing constraints if they
1185         exist.
1186         (pp_cxx_init_declarator): New. Print trailing requirements.
1187         (pp_cxx_template_declaration): Print leading requirements.
1188         (pp_cxx_requires_clause): New.
1189         * gcc/cp/pt.c (build_template_decl): Ensure completion of constraints
1190         when associating them with the template.
1191         (add_inherited_template_parms): Update to new constraint mechanisms.
1192         (redeclare_class_template): Update to new constraint mechanisms.
1193         (tsubst_decl): Update to new constraint mechanism.
1194         * gcc/cp/parser.c (cp_parser_lambda_expression): Save off constraints
1195         in a generic lambda.
1196         (cp_check_constrained_type_parm): Save leading requirements instead
1197         of finishing them.
1198         (cp_parser_trailing_requirements): Simplify by just saving the trailing
1199         requirements.
1200         (cp_parser_init_declarator): Save off constraints before parsing the
1201         declarator.
1202         (cp_parser_member_declaration): Save off requirements before parsing
1203         the declarator.
1204         (cp_parser_requires_clause): Defer constexpr check until as late as
1205         possible.
1206         (cp_parser_template_declaration_after_export): Save leading requirements
1207         instead of finishing them.
1208         (synthesize_implicit_template_parm): Save leading requirements when
1209         processing a constrained-type-specifier.
1210         * gcc/cp/class.c (get_member_fn_template): Update to use new constraint
1211         mechanism.
1212         * gcc/cp/call.c (constraint_failure): Renamed from
1213         template_constraint_failure. Produce reasons for non-template functions.
1214         (is_constrainable_non_template_fn): Removed.
1215         (add_function_candidate): Use new constraint association framework.
1216         * gcc/cp/ptree.c (cxx_print_xnode): Dump leading, trailing requirements.
1217         * gcc/cp/error.c (dumpl_template_decl): Print a leading requires-clause.
1218         (dump_function_decl): Print a trailing requires-clause.
1219         * gcc/cp/semantics.c (finish_template_template_parm): Finish
1220         template constraints before associating them.
1221         * gcc/cp/constraint.cc (reduce_call): Don't fold constants when
1222         substituting.
1223         (reduce_template_id): Replace EXPR_LOCATION in diagnostics. Return
1224         error_mark_node instead of corrected call expression.
1225         (reduce_requirements): Don't normalize a null expression.
1226         (make_constraints): Removed.
1227         (get_constraints): Updated.
1228         (set_constraint): Updated.
1229         (get_shorthand_requirements): Use the appropriate macro.
1230         (build_constraint_info, init_leading_requirements, 
1231         init_trailing_requirements, update_leadng_requirements,
1232         update_trailing_requirements, save_leading_requirements,
1233         save_trailing_requirements): New.
1234         (finish_template_requirements): Analyze and decompose constraints.
1235         (valid_template_requirements_p): New.
1236         (instantiate_requirements): New flag.
1237         (tsubst_constraint_info): New.
1238         (check_requirements): Update.
1239         (check_constraints): Add another round of instantiation to ensure
1240         that all non-constexpr exprs are folded out of the expression.
1241         (check_constraints): Update.
1242         (equivalent_constraints): Redefine constraint equivalence in terms
1243         of tokens (patch by Braden Obrzut).
1244         (diagnose_trait, diagnose_check, diagnose_requires, 
1245         diagnose_constraints): Update.
1246         * gcc/cp/decl2.c (check_classfn): Update constraint mechanisms.
1247         * gcc/cp/decl.c (decls_match): Update to use new constraints.
1248         (duplicate_decls): members match if they have equivalent constraints.
1249         (get_leading_template_requirements): New.
1250         (adjust_out_of_class_fn_requirements): New.
1251         (grokfndecl): Associate requirements with a function declaration.
1252         * gcc/testsuite/g++.dg/concepts/*: New tests.
1254 2014-06-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
1255         
1256         * gcc/c-family/c.opt (flag_concepts): Don't enable by default.
1257         * gcc/c-family/c-opts.c (set_std_cxx1z): Enable concepts if
1258         -std=cxx1z is selected.
1259         * gcc/c-family/c-format.c (gcc_cxxdia): Add "Z" as format specifier.
1260         * gcc/cp/c-common.c (cxx_dialect): Make -std=c++98 the default
1261         language again.
1262         * gcc/cp/lex.c (cxx_init): Don't set flag_concepts explicitly.
1263         * gcc/testsuite/g++.dg/concepts/*.C: Update build flags.
1265 2014-06-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
1266         
1267         * gcc/cp/cp-tree.h (DECL_CONSTRAINTS): Remove this macro; use
1268         get_constraints instead.
1269         (set_constraints): new.
1270         * gcc/cp/cxx-pretty-print.c (pp_cxx_template_declaration): Use
1271         get_constraints.
1272         * gcc/cp/pt.c (get_specialization_constraints): Use get_constraints.
1273         (build_template_decl): Use get_constraints.
1274         (process_partial_specialization): Use get_constraints.
1275         (add_inherited_template_parms): Use get_constraints.
1276         (redeclare_class_template): Use get_constraints.
1277         (is_compatible_template_arg): Use get_constraints.
1278         (tsubst_friend_class): Use get_constraints.
1279         (tsubst_decl): Uset get_constraints.
1280         * gcc/cp/semantics.c (finish_template_template_parm): Use
1281         get_constraints.
1282         (fixup_template_type): Use get_constraints.
1283         * gcc/cp/constraint.cc (constraints): New global association
1284         of declarations to constraints.
1285         (get_constraints): Return the associated constraints from the
1286         hash table.
1287         (set_constraints): New. Associate constraints with a declaration.
1288         (check_template_constraints): Use get_constraints.
1289         (equivalently_constrained): Use get_constraints.
1290         (more_constrained): Use get_constraints.
1291         (diagnose_constraints): Use get_constraints.
1292         * gcc/testsuite/g++.dg/concepts/partial-spec.C: New.
1294 2014-06-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
1295         
1296         * gcc/cp/parser.c (cp_parser_requires_clause): Don't fold expressions
1297         when parsing a requires-clause.
1298         * gcc/cp/constraint.cc (reduce_requirements): Don't fold
1299         expressions during constraint normalization.
1301 2014-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
1302         
1303         * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): Defer
1304         handling the BASELINK check until concept-resolution in order to
1305         allow member conceps.
1306         (cp_parser_nonclass_name): Also Check for concept-names when the
1307         lookup finds a BASELINk.
1308         * gcc/cp/constraint.cc: (resolve_constraint_check) If the call
1309         target is a base-link, resolve against its overload set.
1310         (build_concept_check): Update comments and variable names to
1311         reflect actual processing.
1312         * gcc/testuite/g++.dg/concepts/mem-concept.C: New test.
1313         * gcc/testuite/g++.dg/concepts/mem-concept-err.C: New test.
1315 2014-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
1316         
1317         * gcc/cp/error.c (dump_expr): Pretty print placeholder to improve
1318         debug output.
1320 2014-06-17  Braden Obrzut  <admin@maniacsvault.net>
1321         
1322         * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): If getting
1323         a baselink, use the referred-to function/overload declarations rather
1324         than asserting.
1326 2014-06-12  Andrew Sutton  <andrew.n.sutton@gmail.com>
1327         
1328         * gcc/cp/constraint.cc (deduce_constrained_parameter): Refactor
1329         common deduction framework into separate function.
1330         (build_call_check): New.
1331         (build_concept_check): Take additional arguments to support the
1332         creation of constrained-type-specifiers from partial-concept-ids.
1333         (build_constrained_parameter): Take arguments from a partial-concept-id.
1334         * gcc/cp/cp-tree.h (build_concept_check, biuld_constrained_parameter):
1335         Take a template argument list, defaulting to NULL_TREE.
1336         * gcc/cp/parser.c (cp_parser_template_id): Check to see if a 
1337         template-id is a concept check.
1338         (cp_check_type_concept): Reorder arguments
1339         (cp_parser_allows_constrained_type_specifier): New. Check contexts
1340         where a constrained-type-specifier is allowed.
1341         (cp_maybe_constrained_type_specifier): New. Refactored common rules
1342         for concept name checks.
1343         (cp_maybe_partial_concept_id): New. Check for 
1344         constrained-type-specifiers.
1345         * gcc/testuite/g++.dg/concepts/partial.C: New tests.
1346         * gcc/testuite/g++.dg/concepts/partial-err.C: New tests.
1347         * gcc/testuite/g++.dg/concepts/concepts.exp: Add missing test driver.
1349 2014-06-12  Andrew Sutton  <andrew.n.sutton@gmail.com>
1350         
1351         * gcc/cp/parser.c (cp_check_type_concept): New.
1352         (cp_check_concept_name): Remove redundant condition from check.
1353         Diagnose misuse of non-type concepts in constrained type specifiers.
1354         * gcc/testuite/g++.dg/concepts/generic-fn.C: Add tests for
1355         non-simple constrained-type-specifiers and nested-name-specifiers
1356         in concept names.
1357         * gcc/testuite/g++.dg/concepts/generic-fn-err.C: New tests for
1358         diagnosing ill-formed programs.
1360 2014-06-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
1361         
1362         * gcc/cp/cp-tree.h (build_constrained_parameter): Renamed fro
1363         describe_tempalte_parm.
1364         * gcc/cp/parser.c (cp_check_constrained_type_parm): New. Prevent
1365         declaration of cv-qualifed or non-id types.
1366         (cp_constrained_type_template_parm): Renamed, check for invalid 
1367         specifiers.
1368         (cp_constrained_template_template_parm): Renamed, check for invalid
1369         specifiers.
1370         (cp_constrained_non_type_tmeplate_parm): Renamed.
1371         (cp_finish_constrained-parameter): Support checking of decarlarations.
1372         (cp_check_concept_name): Renamed. Add initial support for auto
1373         and constrained-type-specifiers in compound requirements.
1374         (cp_parser_nonclass_name): Only check for concept names if -fconcepts
1375         is on.
1376         (cp_manage_requirements): New RAII guard for managinging the
1377         current_template_reqs variable during declaration parsing.
1378         (cp_paresr_trailing_requirements): Refactored common parsing
1379         requirements from cp_parser_init_declarator and 
1380         cp_parser_member_declarator. Take terse constraints from implicit
1381         parameter declarations.
1382         (cp_parser_init_declarator): Cleanup, refactor requirement logic.
1383         (cp_parser_type_id_1): Allow auto in compound requirements.
1384         (cp_parser_member_declaration): Cleanup, refactor requirement logic.
1385         (cp_parser_compound_requirement): Note parsing state for the 
1386         trailing-type-id so we can get auto and constrained-type-specifiers.
1387         (cp_parser_function_definition_after_decl): Remove broken constraint
1388         association.
1389         * gcc/cp/parser.h (cp_parser): New member.
1390         * gcc/cp/constraint.cc (finish_validtype_expr): Initial (non-)handling
1391         of auto in type requirements.
1392         (finish_concept_name): Moved to cp_check_concept_name.
1393         * gcc/testuite/g++.dg/concepts/constrained-parm.C: New test.
1394         * gcc/testuite/g++.dg/concepts/generic-fn.C: New test.
1397 2014-03-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
1398         
1399         * gcc/testuite/g++.dg/concepts/fn1.C: New test.
1400         * gcc/testuite/g++.dg/concepts/fn2.C: New test.
1402 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
1403         
1404         * gcc/cp/parser.c (synthesize_implicit_template_parm): Allow concepts
1405         to declare implicit template parameters. Only synthesize new parameters
1406         if the concept name is new.
1407         (finish_concept_name): Moving into parser.c for the time being. Needs
1408         to be rewritten to remove duplicate code between parser.c and
1409         constraint.cc.
1411 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
1412         
1413         * gcc/cp/pt.c (tsubst_copy): Expand pack expansions as conjunctions.
1415 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
1416         
1417         * gcc/cp/pt.c (tsubst_pack_conjunction): Don't try to conjoin
1418         dependent expressions.
1420 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
1421         
1422         * gcc/cp/semantics.c (fixup_template_type): Compare primary template
1423         types to specializations using structural types so we don't run into
1424         canonical type errors with constrained specializations.
1426 2013-11-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
1427         
1428         * gcc/cp/pt.c (add_inherited_template_parms): Instantiate requirements
1429         in a processing template decl context.
1431 2013-11-05  Andrew Sutton  <andrew.n.sutton@gmail.com>
1432         
1433         * gcc/cp/semantics.c (fixup_template_type): Add a same-type check
1434         for specialiations so we don't accidentally match non-dependent
1435         specializations having a different type.
1437 2013-10-26  Ville Voutilainen  <ville.voutilainen@gmail.com>
1438         
1439         * gcc/cp/decl.c (grokdeclarator): Reject concept keyword
1440         in typedefs, function parameters, data members, non-static
1441         member functions and variables. Allow static member functions
1442         to be concepts.
1444 2013-10-30  Andrew Sutton  <andrew.n.sutton@gmail.com>
1445         
1446         * gcc/cp/semantics.c (fixup_template_type): Don't emit errors when
1447         no templates can be found with matching constraints.
1449 2013-10-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
1450         
1451         * gcc/cp/parsre.c (cp_parser_requires_expression): Gracefully
1452         fail when parsing a requires expr outside a template.
1454 2013-10-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
1455         
1456         * gcc/cp/c-common.c (c_common_r): Remove unused keywords "assume",
1457         "axiom", and "forall".
1458         * gcc/cp/c-common.h (rid): Removed unused reserved word ids.
1460 2013-10-24  Edward Smith-Rowland  <3dw4rd@verizon.net>
1461         
1462         * gcc/cp/typeck.c (cp_build_function_call_vec): Use unused variable 
1463         loc.
1465 2013-10-23  Andrew Sutton  <andrew.n.sutton@gmail.com>
1466         
1467         * gcc/cp/class.c (get_member_fntemplate): New.
1468         (are_constrained_member_overloads): Only get a template declaration
1469         if the member function is, in fact, a template or temploid.
1470         * gcc/cp/pt.c (check_explicit_specialization): Do not allow
1471         explicit specializations to be declared 'concept', and do not allow
1472         an explicit specialization of a concept.
1473         * gcc/cp/decl.c (grokfndecl): Propagate the concept flag to
1474         check_explicit_specialization.
1476 2013-10-22  Andrew Sutton  <andrew.n.sutton@gmail.com>
1477         
1478         * gcc/c-family/c-common.c (cxx_dialect): Make the default
1479         language C++11.
1480         * gcc/cp/constraint.cc (check_constrained_friend): Don't assert
1481         on error_mark_node.
1483 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
1484         
1485         * gcc/cp/logic.cc (left_requires), (decompose_left): Add
1486         decomposition rules for requires expressions.
1487         (subsumes_requires), (subsumes_prop): Add subsumption rules for
1488         requires expressions.
1489         * gcc/cp/constraint.cc (diagnose_trait): Diagnose failed conversion
1490         requirements.
1492 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
1493         
1494         * gcc/cp/constraint.cc (finish_concept_name): Allow functions with
1495         the same name as concepts to resolve as call expressions in the
1496         usual way.
1498 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
1499         
1500         * gcc/cp/constraint.cc (conjoin_requiremens): New.
1501         (resolve_constraint_check): Filter non-concept candidates before
1502         coercing arguments. Perform deduction in a template-decl processing
1503         context to prevent errors during diagnosis.
1504         (finish_concept_name), (finish_shorthand_requirement),
1505         (get_shorthand_requirements): New.
1506         * gcc/cp/pt.c (template_parm_to_arg): Make non-static.
1507         (process_templat_parm): Build shorthand requirements from the
1508         parameter description.
1509         (end_templat_parm_list): New.
1510         (convert_placeholder_argument): New.
1511         (convert_template_argument): Match placeholder arguments against
1512         any template parameter.
1513         (tsubst_pack_conjuction):  New.
1514         (tsubst_expr): Expand a pack as a conjunction.
1515         (type_dependent_expression_p): Placeholders are always type
1516         dependent.
1517         * gcc/cp/parser.c (cp_is_constrained_parameter), 
1518         (cp_finish_template_type_parm), (cp_finish_template_template_parm)
1519         (cp_finish_non_type_template_parm), (cp_finish_constrined_parameter):
1520         New.
1521         (cp_parser_template_parameter): Handle constrained parameters.
1522         (cp_parser_nonclass_name): An identifier naming an overload set
1523         may declare a constrained parameter.
1524         (cp_parser_type_parameter), (cp_parser_template_declaration_after_exp): 
1525         Get shorthand requirements from the tmeplate parameter list.
1526         * gcc/cp/cp-tree.h (TEMPLATE_PARM_CONSTRAINTS): New.
1528 2013-10-07  Andrew Sutton  <andrew.n.sutton@gmail.com>
1529         
1530         * gcc/cp/cp-tree.h (check_constrained_friend): Take requirements as
1531         an argument.
1532         * gcc/cp/constraints.cc (check_constrained_friend): Do not diagnose
1533         errors in unconstrained friend declarations.
1534         * gcc/cp/parser.cc (cp_parser_member_declaration): Pass current
1535         requirements to check_constrained_friend.
1537 2013-10-07  Andrew Sutton  <andrew.n.sutton@gmail.com>
1538         
1539         * gcc/cp/parser.c (cp_parser_member_declaration): Check that
1540         a constrained friend definition is valid.
1541         * gcc/cp/decl.c (grokfndecl): Disallow constrained friend template
1542         specializations.
1543         * gcc/cp/constraints.cc (check_constrained_friend): New.
1544         * gcc/cp/typeck.c (cp_build_function_call_vec): Diagnose constraints
1545         in the presence of the failure of a single candidate.
1546         * gcc/cp/cp-tree.h (check_constrained_friend): New.
1547         * gcc/cp/call.c (is_non_template_member_fn): Make inline.
1548         (is_non_template_friend), (is_constrainable_non_template_fn): New.
1549         (add_function_candidate): Predicate check on
1550         is_constrainable_non_template_fn.
1552 2013-09-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
1554         * gcc/cp/cp-tree.h (TEMPLATE_PARMS_CONSTRAINTS): New.
1555         * gcc/cp/parser.c (cp_parser_template_declaration_after_export),
1556         (cp_parser_type_parameter): Use TEMPLATE_PARMS_CONSTRAINTS.
1557         * gcc/cp/semantics.c (fixup_template_scope): Use 
1558         TEMPLATE_PARMS_CONSTRAINTS.
1560 2013-09-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
1561         
1562         * gcc/cp/cxx-pretty-print.c (pp_cxx_compound_requirement),
1563         (pp_cxx_type_requirement), (pp_cxx_validtype_expr): Use 
1564         pp->type_id() instead of pp_cxx_type_id().
1566 2013-09-09  Andrew Sutton  <andrew.n.sutton@gmail.com>
1568         * gcc/cp/pt.c (get_class_bindings): Pass the partial specialization
1569         for constraint evaluation. Evaluate constraints, resulting in
1570         deduction failure on error.
1571         (get_specializaing_template_decl), (get_specialization_constraints),
1572         (maybe_new_partial_specialization): New.
1573         (maybe_process_partial_specialization): Allow the creation of
1574         new types for constrained partial specializations.
1575         (process_partial_specialization): Modify the canonical type
1576         of constrained partial specializations.
1577         (instantiate_class_template_1): Do not explicitly check constraints
1578         during class template instantiation.
1579         (tsubst_decl): Instantiate the constraints of template declarations.
1580         (more_specialized_class): Pass specializations to get_class_bindings().
1581         Compare specialization constraints if the types are equivalent.
1582         (most_specialized_class): Pass specialization to get_class_bndings().
1583         * gcc/cp/decl2.c (check_class_fn): Get the decl's requirements from
1584         either the current template reqs or from the template parameters.
1585         Allow overloading of constrained out-of-class member definitions.
1586         * gcc/cp/semantics.c (fixup_template_type): New. Match the template
1587         scope to a specialization with appropriate constraints.
1588         (finish_template_type): Fix template type when entering scope.
1589         * gcc/cp/parser.c (cp_parser_parse_type_parameter): Attach
1590         requirements to the current template parameter list.
1591         (cp_parser_init_declarator): Parse requires clauses for out-of-class
1592         member definitions. Be sure to restore current constraints before
1593         exiting the function.
1594         (cp_parser_member_declarator): Restore the previous requirements in
1595         an early-exit branch.
1596         (cp_parser_late_parsing_for_member): Restore constraints after
1597         maybe_end_member_template_processing().
1598         (cp_parser_template_declaration_after_exp): Attach constraints to
1599         the current template parameters.
1600         * gcc/cp/constraint.cc (reduce_template_id): Don't crash when
1601         omitting ()'s on constraint calls.
1602         (check_requirements): Don't evaluate dependent arguments.
1603         (check_constraints): Don't try to evaluate when arguments are
1604         dependent.
1605         (equivalent_constraints): Optimize the case when a and b are the
1606         same constraints.
1608 2013-07-26  Andrew Sutton  <andrew.n.sutton@gmail.com>
1609         
1610         * gcc/cp/semantics.c (trait_expr_value): Evaluate __is_same_as.
1611         (finish_trait_expr): Check __is_same_as and __is_convertible_to.
1612         * gcc/cp/constraint.cc (diagnose_trait): Diagnose failures in
1613         __is_same_as.
1614         * gcc/cp/parser.c (cp_parser_primary_expression), 
1615         (cp_parser_trait_expr): Parse __is_same_as.
1616         * gcc/cp/cp-tree.h (cp_trait_kind): Add CPTK_IS_SAME_AS.
1617         * gcc/cp/cxx-pretty-print.c (pp_cxx_trait_expression): Pretty print
1618         __is_same_as trait.
1620 2013-07-26  Andrew Sutton  <andrew.n.sutton@gmail.com>
1622         * gcc/cp/tree.c (cp_walk_subtrees): Don't recurse through the
1623         requires expr parameter list.
1625 2013-07-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
1626         
1627         * gcc/cp/parser.c (cp_parser_requires_expr): Update parser using new
1628         requires expression nodes. Renamed some grammar productions to better 
1629         reflect the representation of the syntax. Create a new scope for 
1630         requires parameters.
1631         (cp_parser_nested_requirement): Wrap results in a NESTED_REQ node.        
1632         * gcc/cp/semantics.c (xvalue_result_type): New.
1633         (trait_expr_value): Evaluate __is_convertible_to.
1634         (finish_requires_expr): Implemented, along with other functions to
1635         construct and evaluate nodes for template constraints.
1636         (potential_constant_expression_1): Handle requires expressions.
1637         (finish_template_requirements), (finish_requires_expr), etc:
1638         Move to constraint.cc.
1639         * gcc/cp/cp-tree.def: (REQUIRES_EXPR), (EXPR_REQ), (TYPE_REQ),
1640         (NESTED_REQ), (VALIDEXPR_EXPR), (VALIDTYPE_EXPR), (CONSTEXPR_EXPR):
1641         New.
1642         * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Make new nodes typed.
1643         * gcc/cp/cp-tree.h (finish_expr_requirement), 
1644         (finish_type_requirement), (finish_nested_requirement),
1645         (finish_validexpr_expr), (finish_validtype_expr),
1646         (finish_constexpr_expr): New.
1647         * gcc/cp/pt.c (convert_nontype_argument): Use can_convert_standard.
1648         (retrieve_local_specialization), (register_local_specialization),
1649         (extract_fnparm_pack): Make non-static.
1650         (tsubst_expr): Substitution rules for requires expressions.
1651         (instantiate_requirements): Move to constraints.cc
1652         (tsubst_constraint): Remove.
1653         * gcc/cp/call.c (can_convert): Allow user-defined conversions.
1654         (can_convert_standard): New.
1655         * gcc/cp/cvt.c (convert_to_reference): Use can_convert_standard.
1656         * gcc/cp/search.c (check_final_overrider): Use can_cnvert_standard.
1657         * gcc/cp/typeck.c (build_static_cast_1): Use can_convert_standard.
1658         * gcc/cp/error.c (dump_expr): Pretty print new nodes.
1659         * gcc/cp/cxx-pretty-print.c (pp_cxx_primary_expression): Pretty
1660         print new expr/req nodes.
1661         (pp_cxx_requires_expr): New along with related functions for
1662         pretty printing requirements.
1663         (pp_cxx_parameter_declaration_clause): Accommodate "raw" parameter
1664         lists in addition to function decls.
1665         (pp_cxx_requirement_parameter_list): Unified with parameter decl clause.
1666         * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_expr): New along with
1667         related functions for pretty printing requirements.     
1668         * gcc/cp/logic.cc: Move header comments to top of file.
1669         * gcc/cp/constraint.cc (reduce_requirements): Handle requires
1670         expressions.
1671         (diagnose_constraints): Rename and handle requires expressions.
1673 2013-07-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
1674         
1675         * gcc/cp/error.c (cp_printer): Fix unnecessary whitespace change.
1676         * gcc/cp/constraint.cc (diagnose_node): Don't fail diagnosing
1677         disjunctions.
1679 2013-07-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
1680         
1681         * gcc/cp/class.c (are_constrained_member_overloads): Fix doc typos.
1683 2013-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
1684         
1685         * gcc/cp/parser.c (cp_parser_init_declarator): Parse template
1686         requirements for out-of-class member definitions.
1687         * gcc/cp/decl2.c (check_classfn): Include match out-of-class
1688         definitions using constraints.
1689         * gcc/cp/constraint.cc (equivalently_constrained). Use get_constraints.
1690         (more_constrained). Use get_constraints. 
1692 2013-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
1693         
1694         * gcc/cp/cp-tree.h (tree_template_info). Remove constraint from 
1695         template info.
1696         (check_template_info): Removed (unused).
1697         (TI_CONSTRAINT): Removed (no longer needed) along with related macros.
1698         (DECL_CONSTRAINTS): New. Get constraints from DECL_SIZE_UNIT for 
1699         template decls.
1700         (build_template_info): Removed overload taking constraints.
1701         (get_constraints): Removed (no longer needed).
1702         * gcc/cp/class.c (are_constrained_member_overlaods): Allow constrained 
1703         member function templates to be differentiated as overloads.
1704         * gcc/cp/decl.c (decls_match): Only compare constraints on 
1705         declarations.
1706         (grokfndecl): Don't pass constraints to build_template_info.
1707         * gcc/cp/tree.c (bind_template_template_parm): Don't pass constraints 
1708         to build_template_info.
1709         * gcc/cp/pt.c (build_template_info): Removed overload taking 
1710         constraints.
1711         (check_explicit_specialization): Don't build new constraints for 
1712         template info.
1713         (build_template_decl): Pass constraints. Update docs.
1714         (process_partial_specialization): Stub out support for constrained
1715         partial specialiations.
1716         (push_template_decl_real): Build template decls with current template 
1717         reqs. Don't pass constraints to build_template_info.
1718         (add_inherited_template_parms): Build new constraints from inherited
1719         template constructors.
1720         (redeclare_class_template): Update to new constraint interface.
1721         (is_compatible_template_arg): Update to new constraint interface.
1722         (lookup_template_class_1): Don't build new constraints or pass them to
1723         build_template_info.
1724         (instantiate_class_template_1): Update to new constraints interface.
1725         (tsubst_decl): Don't build new constraints or pass them to
1726         build_template_info. For function templates, explicitly instantiate
1727         new constraints for member functions of class templates.
1728         * gcc/cp/semantics.c: Associate constraints with template template 
1729         parms directly, not through template info.
1730         * gcc/cp/constraint.cc (get_constraints): Simplified to use new constraints
1731         interface.
1732         (check_constraints): Update to use new constraints interface.
1733         (equivalently_constrained): Update to use new constraints interface.
1734         (more_constrained): Update to use new constraints interface.
1735         * gcc/cp/parser.cpp (cp_parser_late_parsing_for_member): Update to use 
1736         new constraints interface.
1737         * gcc/cp/call.c (is_non_template_member_fn): New.
1738         (add_function_candidate): Only check constraints for non-template member
1739         functions.
1741 2013-06-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
1742         
1743         * gcc/cp/parser.c (cp_parser_requires_clause): Pulled out of
1744         cp_parser_requires_clause_opt for reuse in the requires expr parser.
1745         (cp_parser_requires_expression): New, along with a family of
1746         sub-expression parsers for the new feature.
1747         * gcc/cp/semantics.c (finish_requires_expr): Stub.
1748         (finish_syntax_requirement): Stub.
1749         (finish_type_requirement): Stub.
1750         (finish_constexpr_requirement): Stub.
1751         (finish_noexcept_requirement): Stub.
1752         (finish_requires_expr): Stub.
1753         * gcc/cp/cp-tree.h: (finish_requires_expr): New.
1754         (finish_syntax_requirement): New.
1755         (finsih_type_requirement): New.
1756         (finish_constexpr_requirement): New.
1757         (finish_noexcept_requirement): New.
1759 2013-06-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
1760         
1761         * gcc/cp/error.c (subst_to_string): Allow this to be called explicitly
1762         passing template parameters in the TREE_TYPE and with a null 
1763         TREE_PURPOSE.
1764         * constraint.cc (check_requirements): New overload taking template
1765         arguments.
1766         (check_constraints.cc): Move instantiation and checking into the
1767         new check_requirements overload.
1768         (diagnose_requirements): New family of functions for diagnosing 
1769         constraint failures.
1771 2013-06-18  Andrew Sutton  <andrew.n.sutton@gmail.com>
1772         
1773         * gcc/cp/class.c (are_constrained_member_overloads): New.
1774         (add_method): Allow overloading of constrained member functions.
1775         * gcc/cp/call.c (rejection_reason_code): New rr_constraint_failure.
1776         (template_constraint_failure): New.
1777         (add_function_candidate): Check for viability as a precondition to use.
1778         (add_template_candidate_real): Integrate constraint diagnostics.
1779         Provide constraint info for new template instantiations.
1780         (print_z_candidate): Emit diagnostics for constraint failures.
1781         (template_decl_for_candidate): New.
1782         (joust): Allow non-member templates of class templates to be evaluated
1783         in more_specialized_fn if they are constrained.
1784         * gcc/cp/ptree.c (cxx_print_xnode): Dump constraint info.
1785         * gcc/cp/semantics.c (finish_template_template_parm): Build template
1786         info for template template parameters.
1787         (is_unary_trait): New.
1788         (is_binary_trait): New.
1789         (finish_trait_expr): Check for binary traits using new function.
1790         * gcc/cp/constraint.cc (join_requirements): New
1791         (conjoin_requirements): Join expressions correctly. Fixed docs.
1792         (disjoin_requirements): Removed.
1793         (is_constriant): Removed.
1794         (resolve_constraint_check): New. Replaces previous get_constraint
1795         check and related functions.
1796         (get_constraints): New, along with helper functions.
1797         (suppress_template_processing): New. 
1798         (check_template_constraints): New, along with helper functions.
1799         (equivalent_constraints): New.
1800         (equivalently_constrained): New.
1801         (more_constraints): New.
1802         (more_constrianed): New.
1803         (diagnose_constraint_failure): New.
1804         * gcc/cp/decl.c (decls_match): Check for constraint equivalence if
1805         the types are the same.
1806         (check_concept_refinement): New.
1807         (are_constrained_overloads): New.
1808         (duplicate_decls): Handle constraints for ambigous declarations. Check
1809         and diagnose concept refinement.
1810         (check_concept_fn): Don't fail completely just because the concept
1811         isn't defined correctly. Allow analysis to continue as if declared
1812         constexpr. Concepts must return bool.
1813         * gcc/cp/tree.c (bind_template_template_parm): Provide empty 
1814         constraints for bound template template parameters.
1815         * gcc/cp/logic.cc: Rewrite of proof state and related structures and
1816         decomposition logic. Removed right-decomposition logic, but retained
1817         right-logical rules.
1818         (match_terms): Renamed from entails.
1819         (subsumes_prop): Cleanup, added specific handlers for and/or cases.
1820         (subsumes_constraints): Update from interface change.
1821         * gcc/cp/cp-tree.h (check_constraint_info): Renamed and applied
1822         interface change.
1823         (check_template_info): Renamed and applied interface change.
1824         (cp_unevaluated): New
1825         (local_specialization_stack): New.
1826         (coerce_template_parms): New.
1827         (is_unary_trait): New.
1828         (is_binary_trait): New.
1829         (get_constraints): New.
1830         (check_constraints): New.
1831         (check_template_constraints): New.
1832         (subst_template_constraints): New.
1833         (equivalent_constraints): New.
1834         (equivalently_constrained): New.
1835         (more_constraints): New.
1836         (more_constrained): New.
1837         (diagnose_constraints_failure): New.
1838         * gcc/cp/cxx-pretty-print.c (pp_cxx_template_declaration): Print the
1839         template requirements.
1840         * gcc/cp/pt.c (local_specialization_stack): New.
1841         (build_template_info): Refactor into 3-argument version and 
1842         incorporate template requirements.
1843         (check_explicit_specialization): Instantiate requirements for
1844         template info.
1845         (push_template_decl_real): Include constraints in template info.
1846         (redeclare_class_template): Diagnose redeclaration with different
1847         constraints.
1848         (is_compatible_template_arg): New.
1849         (convert_template_argument): Check constraints on template template
1850         arguments and diagnose errors.
1851         (lookup_template_class_1): Check constraints on alias templates.
1852         Keep constraints with instantiated types.
1853         (instantiate_class_template_1): Check constraints on class templates.
1854         (tsubst_decl): Instantiate and keep constraints with template info.
1855         Also, allow dependent pack arguments to produce neww parameter
1856         packs when instantiated.
1857         (coerce_template_parms): New overload.
1858         (tsubst_copy): Handle REAL_TYPE and BOOLEAN_TYPE.
1859         (tsubst_copy_and_build): PARM_DECLs can be instantiated as pack
1860         expansions (used with requires expression).
1861         (fn_type_unification): Check constraints for function templates.
1862         (more_specialized_fn): Determine which candidate is more constrained.
1863         (substitute_template_parameters): Removed.
1864         (tsubst_constraint): New.
1865         (substitute_requirements): New.
1866         * gcc/cp/parser.c: (cp_parser_optional) Removed along with helper
1867         functions, etc.
1868         (cp_unevaluated): New.
1869         (cp_parser_type_parameter): Check for requires kw explicitly, and
1870         save/clear template requirements before parsing the requires clause.
1871         (cp_parser_requires_clause): Removed.
1872         (cp_parser_template_declaration_after_exp): Check for requires kw
1873         explicitly.
1874         * gcc/system.h (cstdlib): Removed include.
1875         * gcc/c-family/c-common.h (D_CXX_CONCEPTS): New flag for disabling
1876         concept keywords.
1877         * gcc/c-family/c.opt (flag_concepts): Remove redundant declaration.
1878         * gcc/c-family/c-common.c (c_common_r): Concept-specific keywords
1879         are only enabled when concepts are enabled.
1881 2013-06-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
1883         * gcc/system.h (cstdlib): Include <cstdlib> to avoid poisoned
1884         declaration errors.
1885         * gcc/c-family/common.c (c_common_r): Added __is_same_as intrinsic,
1886         removed previous, unused intrinsics.
1887         * gcc/c-family/common.h (rid): Added RID_IS_SAME_AS.
1888         * gcc/cp/parser.c (take): New.
1889         (cp_requires_clause): New.
1890         (cp_requires_clause_opt): New.
1891         (cp_rule): New.
1892         (cp_parser_optional_if_token): New.
1893         (cp_parser_optional_if_not_token): New.
1894         (cp_parser_optional_if_keyword): New.
1895         (cp_parser_decl_specifier_seq): Parse 'concept' as a declspec.
1896         (cp_parser_type_parameter): Parse constrained template template parms.
1897         (cp_parser_member_specification_opt): Parse member constraints after
1898         the declaration, not before.
1899         (cp_parser_template_declaration_after_exp): Rewrote parsing for
1900         template requirements
1901         (cp_parser_late_parsing_for_member): Re-push the current template 
1902         requirements when late-parsing member definitions.
1903         * gcc/cp/decl.c (check_concept_fn): New.
1904         (grokfndecl): Semantics for concept declspec.
1905         (grokdeclarator): Semantics for concept declspec.
1906         (xref_tag_1): Update to new interface.
1907         * gcc/cp/constraint.cc (make_constraints): New.
1908         * gcc/cp/cp-objcp-common.c (cp_tree_size): Add case for constraint_info.
1909         * gcc/cp/cp-tree.h (require): New.
1910         (tree_template_info): Add a field for constraint info.
1911         (tree_constraint_info): New.
1912         (constraint_info_p): New.
1913         (template_info_p): New.
1914         (CI_SPELLING): New.
1915         (CI_REQUIREMENTS): New.
1916         (CI_ASSUMPTIONS): New.
1917         (TI_CONSTRAINT): New.
1918         (TI_SPELLING): New.
1919         (TI_REQUIREMENTS): New.
1920         (TI_ASSUMPTIONS): New.
1921         (DECL_TEMPLATE_CONSTRAINT): New.
1922         (CLASSTYPE_TEMPLATE_CONSTRAINT): New.
1923         (ENUM_TEMPLATE_CONSTRAINT): New.
1924         (TEMPLATE_TEMPLATE_PARM_TEMPLATE_CONSTRAINT): New.
1925         (TYPE_TEMPLATE_CONSTRAINT): New.
1926         (cp_tree_node_structure_enum): Added entry for constraint info.
1927         (lang_tree_node): Added entry for constraint info.
1928         (lang_decl_base): Added bit for concept declarations.
1929         (DECL_DECLARED_CONCEPT_P): New.
1930         (cp_decl_spec): Added ds_concept declaration specifier.
1931         * gcc/cp/Make-lang.in (logic.o): New target.
1932         * gcc/cp/semantics.c (finish_template_requirements): Rewrite.
1933         * gcc/cp/logic.cc: New
1934         * gcc/cp-tree.def (CONSTRAINT_INFO): New node.
1935         * gcc/cp/pt.c (current_template_args): Make non-static.
1936         (redeclare_class_template): Take constraints as a 3rd argument
1938 2013-04-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
1939         
1940         * gcc/cp/Make-lang.in: Add constraints.o target.
1941         * gcc/cp/cp-tree.h (substitute_template_parameters): Declare.
1942         (instantiate_requirements): Declare.
1943         (conjoin_requirements): Declare.
1944         (disjoin_requirements): Declare.
1945         (reduce_requirements): Declare.
1946         * gcc/cp/pt.c (substitute_template_parameters): Define.
1947         (instantiate_requirements): Define.
1948         * gcc/cp/pt.c (finish_template_requirements): Call
1949         reduce_requirements to get constraints.
1950         * gcc/cp/parser.c (cp_parser_type_parameter): Restore saved
1951         constraints after parsing template template parameter decl.
1952         * gcc/cp/constraints.cc: New.
1954 2013-03-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
1955         
1956         * gcc/cp/Make-lang.in: Add constraint.c
1957         * gcc/cp/constraint.c: New
1958         (conjoin_requirements): New
1959         (disjoin_requirements): New
1960         (requirement_reduction): New class
1961         (reduce_requirements): New
1962         * gcc/cp/cp-tree.h (reduce_requrements): New
1963         (conjoin_requirements): New
1964         (disjoin_requirements): New
1965         * gcc/cp/cp-tree.h (finish_template_template_parm) Comments.
1966         * gcc/cp/semantics.c (finish_template_requirements) Start
1967         working with requirements.
1970 2013-03-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
1972         * gcc/cp/cp-tree.h (saved_scope): Add template requirements.
1973         (finish_template_requirements): Declare
1974         * gcc/cp/parser.c (cp_parser_template_requirement_opt): Declare.
1975         (cp_parser_template_declaration): Document grammar extensions.
1976         (cp_parser_type_parameter): Parse requirements for template
1977         template parameters.
1978         (cp_parser_member_declaration): Parse requirements for
1979         members of class templates.
1980         (cp_parser_template_requirement_opt): Define.
1981         (cp_parser_template_declaration_after_exp): Parse requirements
1982         for template declarations.
1983         * gcc/cp/semantics.c (finish_template_requirements): Define.
1984         * gcc/cp/lex.c (cxx_init): Enable concepts by default.
1986 2013-03-01  Gabriel Dos Reis  <gdr@integrable-solutions.net>
1988         * lex.c (flag_concepts): Revert left over declaration.
1990 2013-03-01  Gabriel Dos Reis  <gdr@integrable-solutions.net>
1992         * gcc/c-family/c-common.c (cxx_dialect): Set C++11 as default.
1993         * gcc/c-family/c.opt(flag_concepts): Add.
1994         * gcc/cp/lex.c (flag_concepts): New.  Enabled concept support by
1995         default.
1997 2013-02-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
1999         * gcc/c-family/c-common.h (rid): New resreserved words for concepts.
2000         * gcc/c-family/c-common.c (c_common_reswords): Definitions thereof.
2001         * gcc/doc/extend.texi (write_symbol): Initial concept docs.