2014-09-01 Andrew Sutton <andrew.n.sutton@gmail.com>
[official-gcc.git] / ChangeLog.concepts
blob7db4c65130512ad4b79049f43cdeeab3c8334801
1 2014-09-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
3         Fixing normalization in the presence of constructor calls.
4         * gcc/cp/constraint.cc (normalize_misc): Handle constructor
5         expressions.
6         * gcc/testsuite/g++.dg/concepts/req7.C: New.
8 2014-08-29  Andrew Sutton  <andrew.n.sutton@gmail.com>
10         Fixing partial-template-id bug.
11         * gcc/cp/parser.c (cp_parser_type_name): If the returned type-decl
12         is actually a shorthand declaration, don't simulate an error.
13         * gcc/testsuite/g++.dg/concepts/template-parm10.C: New.
15 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
17         Add tests for constrained friends.
18         * gcc/testsuite/g++.dg/concepts/friend1.C: New.
19         * gcc/testsuite/g++.dg/concepts/friend2.C: New.
21 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
23         * gcc/cp/decl.c (is_concept_var): Coding style fix.
25 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
27         Fixing regression in scoping rules for templates.
28         * gcc/cp/semantics.c (fixup_tmeplate_type): Lift check to
29         finish_template_type.
30         (finish_template_type): Only do this when concepts are enabled,
31         and also when the class is actually a template. For non-dependent
32         types there are no actions to be taken.
34 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
36         Additional declaration restrictions on variable concepts.
37         * gcc/cp/decl.c (is_concept_var): New.
38         (cp_finish_decl): Check for uninitialized variable
39         concepts.
40         (grokvardecl): Don't set the concept flag for non-template variables.
41         * g++.dg/concepts/decl-diagnose.C: Add tests.
43 2014-08-19  Ville Voutilainen  <ville.voutilainen@gmail.com>
45         Ban static member function concepts.
46         * gcc/cp/decl.c (grokdeclarator): Diagnose static member function 
47         concepts.
48         * g++.dg/concepts/decl-diagnose.C: Adjust.
49         * g++.dg/concepts/mem-concept-err.C: Adjust.
50         * g++.dg/concepts/mem-concept.C: Adjust.
52 2014-08-15  Andrew Sutton  <andrew.n.sutton@gmail.com>
54         Fixes to variable concept implementation.
55         * gcc/cp/cp-tree.h (variable_concept_p): New.
56         * gcc/cp/parser.c (cp_parser_nonclass_name): Check for concepts,
57         not just templates.
58         * gcc/cp/decl.c (grokvardecl): Label concepts as concepts.
59         * gcc/cp/constraint.cc (check_call): New.
60         (normalize_call): Ensure that calls are probably to functions.
61         (normalize_template_id): Update diagnostics.
62         (finish_template_constraints): Mark assumptions as an error if
63         constraint normalization fails. This was causing normalization
64         to be run twice during the construction of a single declaration.
65         * gcc/testsuite/g++.dg/concepts: Update tests.
67 2014-08-14  Andrew Sutton  <andrew.n.sutton@gmail.com>
69         Fix regression.
70         * gcc/cp/pt.c (value_dependent_expression_p): Don't assume
71         that all nodes have operands.
73 2014-08-14  Andrew Sutton  <andrew.n.sutton@gmail.com>
75         Implement normalization checks.
76         * gcc/cp/constraint.cc (normalize_expr): Delegate cast and
77         atomic nodes to a dedicated function.
78         (check_logical): Check that an && or || does not resolve to a
79         user-defined function.
80         (normalize_logical): Check operators and save the locaiton of
81         the new expression.
82         (normalize_call, normalize_var): Remove spurios error messages.
83         (normalize_cast): New, delegates to normalize atom.
84         (normalize_atom): Check that instantiated expressions can be
85         converted to bool
86         (tsubst_constraint_info): Re-normalize the associated constraints
87         to check for post-substitution restrictions.
88         * gcc/cp/cp-tree.h (xvalue_result_type): Add to header.
90 2014-08-14  Andrew Sutton  <andrew.n.sutton@gmail.com>
92         * gcc/testsuite/g++.dg/concepts: Renamed ttp* to template-parm*,
93         and fixed them.
95 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
97         * gcc/cp/class.c (resolve_address_of_overloaded_function): Check
98         constraints.
99         * gcc/cp/decl.c (grokfndecl): For now, disallow constrained
100         non-template functions.
101         * gcc/testsuite/g++.dg/concepts: New tests.
103 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
105         * gcc/cp/parser.c (get_id_declarator, get_identifier): New helper
106         functions.s
107         (cp_check_constrained_type_parm): Don't fail on null declarators.
108         (cp_finish_constrained_parameter): Remove redundant processing for
109         checking declarations.
110         (cp_maybe_type_parameter, cp_declares_type_parameter, 
111         cp_declares_type_template_parameter, 
112         cp_declares_template_template_parameter): New helper functions for
113         determining when a parameter declaration is actually a constrained
114         template parameter.
115         (cp_parser_default_type_template_argument, 
116         cp_parser_default_template_template_argument): Parsing support
117         for argument types of default arguments.
118         (cp_parser_template_parameter): Finish constrained parameters
119         after all variadic and default arg checks.
120         (cp_parser_parameter_declaration): Parse default arguments
121         differently if the parameter actually declares a type parameter.
122         * gcc/testsuite/g++.dg/concepts: New tests.
124 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
126         * gcc/testsuite/g++.dg/concepts/explicit-spec6.C: New test.
128 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
130         Fix regression in bootstrap.
131         * gcc/cp/call.c (get_temploid): Removed. No longer called.
132         (joust): Remove unused variable declarations.
134 2014-08-13  Andrew Sutton  <andrew.n.sutton@gmail.com>
135         
136         Implement deduction-based explicit instantiation and specialization.
137         * gcc/cp/call.c (joust): Allow all non-templates to be ordered by
138         constraints.
139         * gcc/cp/pt.c (get_class_bindings): Remove superfluous parameter and
140         move constraint check into most_specialized_class.
141         (most_constrained_function): Order functions with the same signatures
142         by their constraints.
143         (determine_specialization): Candidates must satisfy constraints. Also,
144         order non-template candidates by constraints. Improve diagnostics
145         for instances where candidates are rejected.
146         (more_specialized_inst): New. Compare function templates.
147         (most_specialized_instantiation): Refactor to use 
148         more_specialized_inst and order by constraints.
149         (most_specialized_class): Candidates must satisfy constraints.
150         * gcc/cp/decl.c (various) Cosmetic fixes.
151         (adjust_fn_constraints): Rewrite so that class template constraints
152         are not imposed on member function declarations.
153         * gcc/testsuite/g++.dg/concepts: New tests.
155 2014-08-13  Braden Obrzut <admin@maniacsvault.net>
157         * gcc/cp/constraint.cc (deduce_constrained_parameter): Deduce concept
158         from variable concept template-id expressions.
159         (normalize_var): New.
160         (normalize_template_id): Identify variable concepts.
161         (build_concept_check): Handle variable concepts.
162         (finish_shorthand_requirement): Handle variable concepts.
163         (diagnose_var): New.
164         (diagnose_node): Identify variable concepts.
165         * gcc/cp/decl.c (grokvardecl): Pass concept flag through to
166         check_explicit_specialization.
167         (grokdeclarator): Allow variable concepts and pass concept flag through
168         grokvardecl.
169         * gcc/cp/parser.c (cp_is_constrained_parameter): Accept variable
170         concepts.
171         (cp_parser_nonclass_name): Accept variable concepts.
172         (get_concept_from_constraint): Handle variable concepts.
173         * gcc/cp/pt.c (tsubst_copy_and_build): Lookup variable templates.
174         (value_dependent_expression_p): Check requires expressions for value
175         dependence.
176         * gcc/cp/semantics.c (finish_call_expr): Don't instantiate variable
177         templates if processing a template declaration.
178         * gcc/testsuite/g++.dg/concepts/decl-diagnose.C: Change expected error
179         as variable concepts are now handled.
180         * gcc/testsuite/g++.dg/concepts/var-concepts1.C: New test.
181         * gcc/testsuite/g++.dg/concepts/var-concepts2.C: New test.
183 2014-08-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
184         
185         * gcc/cp/pt.c (tsubst): Don't short circuit substitution into
186         types when processing constraints. Also, avoid asserting when
187         substituting into template parameters.
188         * gcc/cp/constraint.c (tsubst_constraint_expr): Indicate that
189         constraint processing is happening.
190         (tsubst_constraint_info): Just substitute directly into the
191         normalized constraints instead of re-normalizing.
192         (diagnose_constraints): Adjust template arguments when
193         diagnosing template constraint failures.
194         * gcc/cp/logic.cc (decompose_assumptions): Handle null assumptions.
196 2014-08-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
197         
198         * gcc/cp/logic.cc (subsumes_constraints_nonnull): Don't re-normalize
199         constraints, it's already been done.
200         * gcc/cp/cp-tree.h (*_requirement[s]): Renamed to *_constraint[s] to
201         reflect wording in specification. Removed reduce_requirements.
202         * gcc/cp/pt.c (process_template_parm, tsubst_pack_conjunction): Update 
203         from renaming.
204         (fn_type_unification): Remove constraint check.
205         * gcc/cp/parser.c (cp_parser_type_parameter, 
206         cp_parser_trailing_requirements, 
207         cp_parser_template_declaration_after_export,
208         synthesize_implicit_template_parm): Update from renaming.
209         * gcc/cp/constraint.cc: Renamed a lot of functions to reflect wording
210         in specification.
211         (finish_template_constraints): Normalize associated constraints.
212         (tsubst_constraint_expr): Renamed from instantiate_requirements.
213         Normalize associated constraints.
214         (check_satisfied): Return true if the arguments refer to template
215         parameters.
216         (all_constraints_satisfied, any_conjunctions_satisfied,
217         check_requirements): No longer needed.
218         (check_diagnostic_constraints): Just normalize the expression, don't
219         decompose it.
221 2014-08-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
223         * gcc/testsuite/g++.dg/concepts/concepts.exp: Add missing argument
224         to g++-dg-runtest.
226 2014-08-06  Andrew Sutton  <andrew.n.sutton@gmail.com>
228         * gcc/cp/constraints.c (tsubst_requires_body, instantiate_requirements):
229         Lift the unevaluated operand guard to the entire constraint expression.
230         (check_satisfied, all_constraints_satisfied, 
231         any_conjunctions_satisfied): Rewrite constraint checking to use
232         atomic constraints. Prevents instantiation of concepts.
233         (check_diagnostic_constraints): Recursively decompose and check
234         constraints for fine-grain diagnostics.
235         (diagnose_*): Use new constraint checking function.
236         
238 2014-07-30  Braden Obrzut  <admin@maniacsvault.net>
239         
240         * gcc/cp/parser.c (cp_parser_trailing_requirements): Handle requires
241         keyword manually so that we can push function parameters back into
242         scope.
243         * gcc/cp/decl.c (push_function_parms): New. Recovers and reopens
244         function parameter scope from declarator.
245         * gcc/testsuite/g++.dg/concepts/req*.C: New tests.
247 2014-07-30  Andrew Sutton  <andrew.n.sutton@gmail.com>
248         
249         * gcc/testsuite/g++.dg/concepts/test.C: Removed.
251 2014-07-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
252         
253         * gcc/cp/cp-tree.h (more_constraints): Remove
254         (subsumes_constraints): Renamed from more_constraints
255         (more_constrained): Repurposed
256         * gcc/cp/call-c (template_decl_for_candidates): Rename to get_temploid,
257         only get template info for member functions of a class template
258         specialization.
259         (joust): Handle member functions of class template specializations
260         separately from function templates. This matches the new wording in
261         the TS.
262         * gcc/cp/logic.cc (match_terms): Make inline.
263         (subsumes_constraints): Rename to subsumes_constraints_nonnull.
264         * gcc/cp/pt.c (is_compatible_template_arg): Use subsumes.
265         (more_specialized_fn): Use usubsumes_constraints.
266         (more_specialized_class): Use more_constrained.
267         * gcc/cp/constraint.cc (more_constraints): Removed.
268         (more_constrained): New.
270 2014-07-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
271         
272         * gcc/cp/typeck.c (cp_build_function_call_vec): Emit diagnostic
273         at the input location.
274         * gcc/cp/error.c (dump_template_decl): Constraints are never invalid
275         in this way. Also fixes brace warning.
277 2014-07-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
278         
279         * gcc/cp/tree.c (cp_tree_equal): compare constraint infos by
280         their associated constraints (patch by Braden Obrzut).
281         * gcc/cp/logic.c (decompose_assumptions): Don't decompose errors.
282         (subsumes_constraints): Update to use new macros.
283         * gcc/cp/cp-tree.h (tree_constraint_info): Rewrite constraints
284         to cache leading, trailing, and associated requirements.
285         (CI_SPELLING, CI_REQUIREMENTS): Remove
286         (CL_LEADING_REQS, CI_TRAILING_REQS, CI_ASSOCIATED_REQS): New
287         accessors for constraint info field.
288         (save_leading_requirements, save_trailing_requirements,
289         valid_template_requirements_p): New.
290         (make_constraints): Removed.
291         (instantiate_requirements): Add flag to substitute in either
292         dependent/non-dependent mode.
293         (tsubst_constraint_info): New.
294         * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_clause): New.
295         * gcc/cp/cxx-pretty-print.c (pp_cxx_init_declarator): Remove.
296         (pp_cxx_function_definition): Print trailing constraints if they
297         exist.
298         (pp_cxx_init_declarator): New. Print trailing requirements.
299         (pp_cxx_template_declaration): Print leading requirements.
300         (pp_cxx_requires_clause): New.
301         * gcc/cp/pt.c (build_template_decl): Ensure completion of constraints
302         when associating them with the template.
303         (add_inherited_template_parms): Update to new constraint mechanisms.
304         (redeclare_class_template): Update to new constraint mechanisms.
305         (tsubst_decl): Update to new constraint mechanism.
306         * gcc/cp/parser.c (cp_parser_lambda_expression): Save off constraints
307         in a generic lambda.
308         (cp_check_constrained_type_parm): Save leading requirements instead
309         of finishing them.
310         (cp_parser_trailing_requirements): Simplify by just saving the trailing
311         requirements.
312         (cp_parser_init_declarator): Save off constraints before parsing the
313         declarator.
314         (cp_parser_member_declaration): Save off requirements before parsing
315         the declarator.
316         (cp_parser_requires_clause): Defer constexpr check until as late as
317         possible.
318         (cp_parser_template_declaration_after_export): Save leading requirements
319         instead of finishing them.
320         (synthesize_implicit_template_parm): Save leading requirements when
321         processing a constrained-type-specifier.
322         * gcc/cp/class.c (get_member_fn_template): Update to use new constraint
323         mechanism.
324         * gcc/cp/call.c (constraint_failure): Renamed from
325         template_constraint_failure. Produce reasons for non-template functions.
326         (is_constrainable_non_template_fn): Removed.
327         (add_function_candidate): Use new constraint association framework.
328         * gcc/cp/ptree.c (cxx_print_xnode): Dump leading, trailing requirements.
329         * gcc/cp/error.c (dumpl_template_decl): Print a leading requires-clause.
330         (dump_function_decl): Print a trailing requires-clause.
331         * gcc/cp/semantics.c (finish_template_template_parm): Finish
332         template constraints before associating them.
333         * gcc/cp/constraint.cc (reduce_call): Don't fold constants when
334         substituting.
335         (reduce_template_id): Replace EXPR_LOCATION in diagnostics. Return
336         error_mark_node instead of corrected call expression.
337         (reduce_requirements): Don't normalize a null expression.
338         (make_constraints): Removed.
339         (get_constraints): Updated.
340         (set_constraint): Updated.
341         (get_shorthand_requirements): Use the appropriate macro.
342         (build_constraint_info, init_leading_requirements, 
343         init_trailing_requirements, update_leadng_requirements,
344         update_trailing_requirements, save_leading_requirements,
345         save_trailing_requirements): New.
346         (finish_template_requirements): Analyze and decompose constraints.
347         (valid_template_requirements_p): New.
348         (instantiate_requirements): New flag.
349         (tsubst_constraint_info): New.
350         (check_requirements): Update.
351         (check_constraints): Add another round of instantiation to ensure
352         that all non-constexpr exprs are folded out of the expression.
353         (check_constraints): Update.
354         (equivalent_constraints): Redefine constraint equivalence in terms
355         of tokens (patch by Braden Obrzut).
356         (diagnose_trait, diagnose_check, diagnose_requires, 
357         diagnose_constraints): Update.
358         * gcc/cp/decl2.c (check_classfn): Update constraint mechanisms.
359         * gcc/cp/decl.c (decls_match): Update to use new constraints.
360         (duplicate_decls): members match if they have equivalent constraints.
361         (get_leading_template_requirements): New.
362         (adjust_out_of_class_fn_requirements): New.
363         (grokfndecl): Associate requirements with a function declaration.
364         * gcc/testsuite/g++.dg/concepts/*: New tests.
366 2014-06-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
367         
368         * gcc/c-family/c.opt (flag_concepts): Don't enable by default.
369         * gcc/c-family/c-opts.c (set_std_cxx1z): Enable concepts if
370         -std=cxx1z is selected.
371         * gcc/c-family/c-format.c (gcc_cxxdia): Add "Z" as format specifier.
372         * gcc/cp/c-common.c (cxx_dialect): Make -std=c++98 the default
373         language again.
374         * gcc/cp/lex.c (cxx_init): Don't set flag_concepts explicitly.
375         * gcc/testsuite/g++.dg/concepts/*.C: Update build flags.
377 2014-06-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
378         
379         * gcc/cp/cp-tree.h (DECL_CONSTRAINTS): Remove this macro; use
380         get_constraints instead.
381         (set_constraints): new.
382         * gcc/cp/cxx-pretty-print.c (pp_cxx_template_declaration): Use
383         get_constraints.
384         * gcc/cp/pt.c (get_specialization_constraints): Use get_constraints.
385         (build_template_decl): Use get_constraints.
386         (process_partial_specialization): Use get_constraints.
387         (add_inherited_template_parms): Use get_constraints.
388         (redeclare_class_template): Use get_constraints.
389         (is_compatible_template_arg): Use get_constraints.
390         (tsubst_friend_class): Use get_constraints.
391         (tsubst_decl): Uset get_constraints.
392         * gcc/cp/semantics.c (finish_template_template_parm): Use
393         get_constraints.
394         (fixup_template_type): Use get_constraints.
395         * gcc/cp/constraint.cc (constraints): New global association
396         of declarations to constraints.
397         (get_constraints): Return the associated constraints from the
398         hash table.
399         (set_constraints): New. Associate constraints with a declaration.
400         (check_template_constraints): Use get_constraints.
401         (equivalently_constrained): Use get_constraints.
402         (more_constrained): Use get_constraints.
403         (diagnose_constraints): Use get_constraints.
404         * gcc/testsuite/g++.dg/concepts/partial-spec.C: New.
406 2014-06-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
407         
408         * gcc/cp/parser.c (cp_parser_requires_clause): Don't fold expressions
409         when parsing a requires-clause.
410         * gcc/cp/constraint.cc (reduce_requirements): Don't fold
411         expressions during constraint normalization.
413 2014-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
414         
415         * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): Defer
416         handling the BASELINK check until concept-resolution in order to
417         allow member conceps.
418         (cp_parser_nonclass_name): Also Check for concept-names when the
419         lookup finds a BASELINk.
420         * gcc/cp/constraint.cc: (resolve_constraint_check) If the call
421         target is a base-link, resolve against its overload set.
422         (build_concept_check): Update comments and variable names to
423         reflect actual processing.
424         * gcc/testuite/g++.dg/concepts/mem-concept.C: New test.
425         * gcc/testuite/g++.dg/concepts/mem-concept-err.C: New test.
427 2014-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
428         
429         * gcc/cp/error.c (dump_expr): Pretty print placeholder to improve
430         debug output.
432 2014-06-17  Braden Obrzut  <admin@maniacsvault.net>
433         
434         * gcc/cp/parser.c (cp_maybe_constrained_type_specifier): If getting
435         a baselink, use the referred-to function/overload declarations rather
436         than asserting.
438 2014-06-12  Andrew Sutton  <andrew.n.sutton@gmail.com>
439         
440         * gcc/cp/constraint.cc (deduce_constrained_parameter): Refactor
441         common deduction framework into separate function.
442         (build_call_check): New.
443         (build_concept_check): Take additional arguments to support the
444         creation of constrained-type-specifiers from partial-concept-ids.
445         (build_constrained_parameter): Take arguments from a partial-concept-id.
446         * gcc/cp/cp-tree.h (build_concept_check, biuld_constrained_parameter):
447         Take a template argument list, defaulting to NULL_TREE.
448         * gcc/cp/parser.c (cp_parser_template_id): Check to see if a 
449         template-id is a concept check.
450         (cp_check_type_concept): Reorder arguments
451         (cp_parser_allows_constrained_type_specifier): New. Check contexts
452         where a constrained-type-specifier is allowed.
453         (cp_maybe_constrained_type_specifier): New. Refactored common rules
454         for concept name checks.
455         (cp_maybe_partial_concept_id): New. Check for 
456         constrained-type-specifiers.
457         * gcc/testuite/g++.dg/concepts/partial.C: New tests.
458         * gcc/testuite/g++.dg/concepts/partial-err.C: New tests.
459         * gcc/testuite/g++.dg/concepts/concepts.exp: Add missing test driver.
461 2014-06-12  Andrew Sutton  <andrew.n.sutton@gmail.com>
462         
463         * gcc/cp/parser.c (cp_check_type_concept): New.
464         (cp_check_concept_name): Remove redundant condition from check.
465         Diagnose misuse of non-type concepts in constrained type specifiers.
466         * gcc/testuite/g++.dg/concepts/generic-fn.C: Add tests for
467         non-simple constrained-type-specifiers and nested-name-specifiers
468         in concept names.
469         * gcc/testuite/g++.dg/concepts/generic-fn-err.C: New tests for
470         diagnosing ill-formed programs.
472 2014-06-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
473         
474         * gcc/cp/cp-tree.h (build_constrained_parameter): Renamed fro
475         describe_tempalte_parm.
476         * gcc/cp/parser.c (cp_check_constrained_type_parm): New. Prevent
477         declaration of cv-qualifed or non-id types.
478         (cp_constrained_type_template_parm): Renamed, check for invalid 
479         specifiers.
480         (cp_constrained_template_template_parm): Renamed, check for invalid
481         specifiers.
482         (cp_constrained_non_type_tmeplate_parm): Renamed.
483         (cp_finish_constrained-parameter): Support checking of decarlarations.
484         (cp_check_concept_name): Renamed. Add initial support for auto
485         and constrained-type-specifiers in compound requirements.
486         (cp_parser_nonclass_name): Only check for concept names if -fconcepts
487         is on.
488         (cp_manage_requirements): New RAII guard for managinging the
489         current_template_reqs variable during declaration parsing.
490         (cp_paresr_trailing_requirements): Refactored common parsing
491         requirements from cp_parser_init_declarator and 
492         cp_parser_member_declarator. Take terse constraints from implicit
493         parameter declarations.
494         (cp_parser_init_declarator): Cleanup, refactor requirement logic.
495         (cp_parser_type_id_1): Allow auto in compound requirements.
496         (cp_parser_member_declaration): Cleanup, refactor requirement logic.
497         (cp_parser_compound_requirement): Note parsing state for the 
498         trailing-type-id so we can get auto and constrained-type-specifiers.
499         (cp_parser_function_definition_after_decl): Remove broken constraint
500         association.
501         * gcc/cp/parser.h (cp_parser): New member.
502         * gcc/cp/constraint.cc (finish_validtype_expr): Initial (non-)handling
503         of auto in type requirements.
504         (finish_concept_name): Moved to cp_check_concept_name.
505         * gcc/testuite/g++.dg/concepts/constrained-parm.C: New test.
506         * gcc/testuite/g++.dg/concepts/generic-fn.C: New test.
509 2014-03-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
510         
511         * gcc/testuite/g++.dg/concepts/fn1.C: New test.
512         * gcc/testuite/g++.dg/concepts/fn2.C: New test.
514 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
515         
516         * gcc/cp/parser.c (synthesize_implicit_template_parm): Allow concepts
517         to declare implicit template parameters. Only synthesize new parameters
518         if the concept name is new.
519         (finish_concept_name): Moving into parser.c for the time being. Needs
520         to be rewritten to remove duplicate code between parser.c and
521         constraint.cc.
523 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
524         
525         * gcc/cp/pt.c (tsubst_copy): Expand pack expansions as conjunctions.
527 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
528         
529         * gcc/cp/pt.c (tsubst_pack_conjunction): Don't try to conjoin
530         dependent expressions.
532 2013-11-012  Andrew Sutton  <andrew.n.sutton@gmail.com>
533         
534         * gcc/cp/semantics.c (fixup_template_type): Compare primary template
535         types to specializations using structural types so we don't run into
536         canonical type errors with constrained specializations.
538 2013-11-08  Andrew Sutton  <andrew.n.sutton@gmail.com>
539         
540         * gcc/cp/pt.c (add_inherited_template_parms): Instantiate requirements
541         in a processing template decl context.
543 2013-11-05  Andrew Sutton  <andrew.n.sutton@gmail.com>
544         
545         * gcc/cp/semantics.c (fixup_template_type): Add a same-type check
546         for specialiations so we don't accidentally match non-dependent
547         specializations having a different type.
549 2013-10-26  Ville Voutilainen  <ville.voutilainen@gmail.com>
550         
551         * gcc/cp/decl.c (grokdeclarator): Reject concept keyword
552         in typedefs, function parameters, data members, non-static
553         member functions and variables. Allow static member functions
554         to be concepts.
556 2013-10-30  Andrew Sutton  <andrew.n.sutton@gmail.com>
557         
558         * gcc/cp/semantics.c (fixup_template_type): Don't emit errors when
559         no templates can be found with matching constraints.
561 2013-10-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
562         
563         * gcc/cp/parsre.c (cp_parser_requires_expression): Gracefully
564         fail when parsing a requires expr outside a template.
566 2013-10-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
567         
568         * gcc/cp/c-common.c (c_common_r): Remove unused keywords "assume",
569         "axiom", and "forall".
570         * gcc/cp/c-common.h (rid): Removed unused reserved word ids.
572 2013-10-24  Edward Smith-Rowland  <3dw4rd@verizon.net>
573         
574         * gcc/cp/typeck.c (cp_build_function_call_vec): Use unused variable 
575         loc.
577 2013-10-23  Andrew Sutton  <andrew.n.sutton@gmail.com>
578         
579         * gcc/cp/class.c (get_member_fntemplate): New.
580         (are_constrained_member_overloads): Only get a template declaration
581         if the member function is, in fact, a template or temploid.
582         * gcc/cp/pt.c (check_explicit_specialization): Do not allow
583         explicit specializations to be declared 'concept', and do not allow
584         an explicit specialization of a concept.
585         * gcc/cp/decl.c (grokfndecl): Propagate the concept flag to
586         check_explicit_specialization.
588 2013-10-22  Andrew Sutton  <andrew.n.sutton@gmail.com>
589         
590         * gcc/c-family/c-common.c (cxx_dialect): Make the default
591         language C++11.
592         * gcc/cp/constraint.cc (check_constrained_friend): Don't assert
593         on error_mark_node.
595 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
596         
597         * gcc/cp/logic.cc (left_requires), (decompose_left): Add
598         decomposition rules for requires expressions.
599         (subsumes_requires), (subsumes_prop): Add subsumption rules for
600         requires expressions.
601         * gcc/cp/constraint.cc (diagnose_trait): Diagnose failed conversion
602         requirements.
604 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
605         
606         * gcc/cp/constraint.cc (finish_concept_name): Allow functions with
607         the same name as concepts to resolve as call expressions in the
608         usual way.
610 2013-10-16  Andrew Sutton  <andrew.n.sutton@gmail.com>
611         
612         * gcc/cp/constraint.cc (conjoin_requiremens): New.
613         (resolve_constraint_check): Filter non-concept candidates before
614         coercing arguments. Perform deduction in a template-decl processing
615         context to prevent errors during diagnosis.
616         (finish_concept_name), (finish_shorthand_requirement),
617         (get_shorthand_requirements): New.
618         * gcc/cp/pt.c (template_parm_to_arg): Make non-static.
619         (process_templat_parm): Build shorthand requirements from the
620         parameter description.
621         (end_templat_parm_list): New.
622         (convert_placeholder_argument): New.
623         (convert_template_argument): Match placeholder arguments against
624         any template parameter.
625         (tsubst_pack_conjuction):  New.
626         (tsubst_expr): Expand a pack as a conjunction.
627         (type_dependent_expression_p): Placeholders are always type
628         dependent.
629         * gcc/cp/parser.c (cp_is_constrained_parameter), 
630         (cp_finish_template_type_parm), (cp_finish_template_template_parm)
631         (cp_finish_non_type_template_parm), (cp_finish_constrined_parameter):
632         New.
633         (cp_parser_template_parameter): Handle constrained parameters.
634         (cp_parser_nonclass_name): An identifier naming an overload set
635         may declare a constrained parameter.
636         (cp_parser_type_parameter), (cp_parser_template_declaration_after_exp): 
637         Get shorthand requirements from the tmeplate parameter list.
638         * gcc/cp/cp-tree.h (TEMPLATE_PARM_CONSTRAINTS): New.
640 2013-10-07  Andrew Sutton  <andrew.n.sutton@gmail.com>
641         
642         * gcc/cp/cp-tree.h (check_constrained_friend): Take requirements as
643         an argument.
644         * gcc/cp/constraints.cc (check_constrained_friend): Do not diagnose
645         errors in unconstrained friend declarations.
646         * gcc/cp/parser.cc (cp_parser_member_declaration): Pass current
647         requirements to check_constrained_friend.
649 2013-10-07  Andrew Sutton  <andrew.n.sutton@gmail.com>
650         
651         * gcc/cp/parser.c (cp_parser_member_declaration): Check that
652         a constrained friend definition is valid.
653         * gcc/cp/decl.c (grokfndecl): Disallow constrained friend template
654         specializations.
655         * gcc/cp/constraints.cc (check_constrained_friend): New.
656         * gcc/cp/typeck.c (cp_build_function_call_vec): Diagnose constraints
657         in the presence of the failure of a single candidate.
658         * gcc/cp/cp-tree.h (check_constrained_friend): New.
659         * gcc/cp/call.c (is_non_template_member_fn): Make inline.
660         (is_non_template_friend), (is_constrainable_non_template_fn): New.
661         (add_function_candidate): Predicate check on
662         is_constrainable_non_template_fn.
664 2013-09-10  Andrew Sutton  <andrew.n.sutton@gmail.com>
666         * gcc/cp/cp-tree.h (TEMPLATE_PARMS_CONSTRAINTS): New.
667         * gcc/cp/parser.c (cp_parser_template_declaration_after_export),
668         (cp_parser_type_parameter): Use TEMPLATE_PARMS_CONSTRAINTS.
669         * gcc/cp/semantics.c (fixup_template_scope): Use 
670         TEMPLATE_PARMS_CONSTRAINTS.
672 2013-09-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
673         
674         * gcc/cp/cxx-pretty-print.c (pp_cxx_compound_requirement),
675         (pp_cxx_type_requirement), (pp_cxx_validtype_expr): Use 
676         pp->type_id() instead of pp_cxx_type_id().
678 2013-09-09  Andrew Sutton  <andrew.n.sutton@gmail.com>
680         * gcc/cp/pt.c (get_class_bindings): Pass the partial specialization
681         for constraint evaluation. Evaluate constraints, resulting in
682         deduction failure on error.
683         (get_specializaing_template_decl), (get_specialization_constraints),
684         (maybe_new_partial_specialization): New.
685         (maybe_process_partial_specialization): Allow the creation of
686         new types for constrained partial specializations.
687         (process_partial_specialization): Modify the canonical type
688         of constrained partial specializations.
689         (instantiate_class_template_1): Do not explicitly check constraints
690         during class template instantiation.
691         (tsubst_decl): Instantiate the constraints of template declarations.
692         (more_specialized_class): Pass specializations to get_class_bindings().
693         Compare specialization constraints if the types are equivalent.
694         (most_specialized_class): Pass specialization to get_class_bndings().
695         * gcc/cp/decl2.c (check_class_fn): Get the decl's requirements from
696         either the current template reqs or from the template parameters.
697         Allow overloading of constrained out-of-class member definitions.
698         * gcc/cp/semantics.c (fixup_template_type): New. Match the template
699         scope to a specialization with appropriate constraints.
700         (finish_template_type): Fix template type when entering scope.
701         * gcc/cp/parser.c (cp_parser_parse_type_parameter): Attach
702         requirements to the current template parameter list.
703         (cp_parser_init_declarator): Parse requires clauses for out-of-class
704         member definitions. Be sure to restore current constraints before
705         exiting the function.
706         (cp_parser_member_declarator): Restore the previous requirements in
707         an early-exit branch.
708         (cp_parser_late_parsing_for_member): Restore constraints after
709         maybe_end_member_template_processing().
710         (cp_parser_template_declaration_after_exp): Attach constraints to
711         the current template parameters.
712         * gcc/cp/constraint.cc (reduce_template_id): Don't crash when
713         omitting ()'s on constraint calls.
714         (check_requirements): Don't evaluate dependent arguments.
715         (check_constraints): Don't try to evaluate when arguments are
716         dependent.
717         (equivalent_constraints): Optimize the case when a and b are the
718         same constraints.
720 2013-07-26  Andrew Sutton  <andrew.n.sutton@gmail.com>
721         
722         * gcc/cp/semantics.c (trait_expr_value): Evaluate __is_same_as.
723         (finish_trait_expr): Check __is_same_as and __is_convertible_to.
724         * gcc/cp/constraint.cc (diagnose_trait): Diagnose failures in
725         __is_same_as.
726         * gcc/cp/parser.c (cp_parser_primary_expression), 
727         (cp_parser_trait_expr): Parse __is_same_as.
728         * gcc/cp/cp-tree.h (cp_trait_kind): Add CPTK_IS_SAME_AS.
729         * gcc/cp/cxx-pretty-print.c (pp_cxx_trait_expression): Pretty print
730         __is_same_as trait.
732 2013-07-26  Andrew Sutton  <andrew.n.sutton@gmail.com>
734         * gcc/cp/tree.c (cp_walk_subtrees): Don't recurse through the
735         requires expr parameter list.
737 2013-07-25  Andrew Sutton  <andrew.n.sutton@gmail.com>
738         
739         * gcc/cp/parser.c (cp_parser_requires_expr): Update parser using new
740         requires expression nodes. Renamed some grammar productions to better 
741         reflect the representation of the syntax. Create a new scope for 
742         requires parameters.
743         (cp_parser_nested_requirement): Wrap results in a NESTED_REQ node.        
744         * gcc/cp/semantics.c (xvalue_result_type): New.
745         (trait_expr_value): Evaluate __is_convertible_to.
746         (finish_requires_expr): Implemented, along with other functions to
747         construct and evaluate nodes for template constraints.
748         (potential_constant_expression_1): Handle requires expressions.
749         (finish_template_requirements), (finish_requires_expr), etc:
750         Move to constraint.cc.
751         * gcc/cp/cp-tree.def: (REQUIRES_EXPR), (EXPR_REQ), (TYPE_REQ),
752         (NESTED_REQ), (VALIDEXPR_EXPR), (VALIDTYPE_EXPR), (CONSTEXPR_EXPR):
753         New.
754         * gcc/cp/cp-objcp-common.c (cp_common_init_ts): Make new nodes typed.
755         * gcc/cp/cp-tree.h (finish_expr_requirement), 
756         (finish_type_requirement), (finish_nested_requirement),
757         (finish_validexpr_expr), (finish_validtype_expr),
758         (finish_constexpr_expr): New.
759         * gcc/cp/pt.c (convert_nontype_argument): Use can_convert_standard.
760         (retrieve_local_specialization), (register_local_specialization),
761         (extract_fnparm_pack): Make non-static.
762         (tsubst_expr): Substitution rules for requires expressions.
763         (instantiate_requirements): Move to constraints.cc
764         (tsubst_constraint): Remove.
765         * gcc/cp/call.c (can_convert): Allow user-defined conversions.
766         (can_convert_standard): New.
767         * gcc/cp/cvt.c (convert_to_reference): Use can_convert_standard.
768         * gcc/cp/search.c (check_final_overrider): Use can_cnvert_standard.
769         * gcc/cp/typeck.c (build_static_cast_1): Use can_convert_standard.
770         * gcc/cp/error.c (dump_expr): Pretty print new nodes.
771         * gcc/cp/cxx-pretty-print.c (pp_cxx_primary_expression): Pretty
772         print new expr/req nodes.
773         (pp_cxx_requires_expr): New along with related functions for
774         pretty printing requirements.
775         (pp_cxx_parameter_declaration_clause): Accommodate "raw" parameter
776         lists in addition to function decls.
777         (pp_cxx_requirement_parameter_list): Unified with parameter decl clause.
778         * gcc/cp/cxx-pretty-print.h (pp_cxx_requires_expr): New along with
779         related functions for pretty printing requirements.     
780         * gcc/cp/logic.cc: Move header comments to top of file.
781         * gcc/cp/constraint.cc (reduce_requirements): Handle requires
782         expressions.
783         (diagnose_constraints): Rename and handle requires expressions.
785 2013-07-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
786         
787         * gcc/cp/error.c (cp_printer): Fix unnecessary whitespace change.
788         * gcc/cp/constraint.cc (diagnose_node): Don't fail diagnosing
789         disjunctions.
791 2013-07-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
792         
793         * gcc/cp/class.c (are_constrained_member_overloads): Fix doc typos.
795 2013-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
796         
797         * gcc/cp/parser.c (cp_parser_init_declarator): Parse template
798         requirements for out-of-class member definitions.
799         * gcc/cp/decl2.c (check_classfn): Include match out-of-class
800         definitions using constraints.
801         * gcc/cp/constraint.cc (equivalently_constrained). Use get_constraints.
802         (more_constrained). Use get_constraints. 
804 2013-06-24  Andrew Sutton  <andrew.n.sutton@gmail.com>
805         
806         * gcc/cp/cp-tree.h (tree_template_info). Remove constraint from 
807         template info.
808         (check_template_info): Removed (unused).
809         (TI_CONSTRAINT): Removed (no longer needed) along with related macros.
810         (DECL_CONSTRAINTS): New. Get constraints from DECL_SIZE_UNIT for 
811         template decls.
812         (build_template_info): Removed overload taking constraints.
813         (get_constraints): Removed (no longer needed).
814         * gcc/cp/class.c (are_constrained_member_overlaods): Allow constrained 
815         member function templates to be differentiated as overloads.
816         * gcc/cp/decl.c (decls_match): Only compare constraints on 
817         declarations.
818         (grokfndecl): Don't pass constraints to build_template_info.
819         * gcc/cp/tree.c (bind_template_template_parm): Don't pass constraints 
820         to build_template_info.
821         * gcc/cp/pt.c (build_template_info): Removed overload taking 
822         constraints.
823         (check_explicit_specialization): Don't build new constraints for 
824         template info.
825         (build_template_decl): Pass constraints. Update docs.
826         (process_partial_specialization): Stub out support for constrained
827         partial specialiations.
828         (push_template_decl_real): Build template decls with current template 
829         reqs. Don't pass constraints to build_template_info.
830         (add_inherited_template_parms): Build new constraints from inherited
831         template constructors.
832         (redeclare_class_template): Update to new constraint interface.
833         (is_compatible_template_arg): Update to new constraint interface.
834         (lookup_template_class_1): Don't build new constraints or pass them to
835         build_template_info.
836         (instantiate_class_template_1): Update to new constraints interface.
837         (tsubst_decl): Don't build new constraints or pass them to
838         build_template_info. For function templates, explicitly instantiate
839         new constraints for member functions of class templates.
840         * gcc/cp/semantics.c: Associate constraints with template template 
841         parms directly, not through template info.
842         * gcc/cp/constraint.cc (get_constraints): Simplified to use new constraints
843         interface.
844         (check_constraints): Update to use new constraints interface.
845         (equivalently_constrained): Update to use new constraints interface.
846         (more_constrained): Update to use new constraints interface.
847         * gcc/cp/parser.cpp (cp_parser_late_parsing_for_member): Update to use 
848         new constraints interface.
849         * gcc/cp/call.c (is_non_template_member_fn): New.
850         (add_function_candidate): Only check constraints for non-template member
851         functions.
853 2013-06-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
854         
855         * gcc/cp/parser.c (cp_parser_requires_clause): Pulled out of
856         cp_parser_requires_clause_opt for reuse in the requires expr parser.
857         (cp_parser_requires_expression): New, along with a family of
858         sub-expression parsers for the new feature.
859         * gcc/cp/semantics.c (finish_requires_expr): Stub.
860         (finish_syntax_requirement): Stub.
861         (finish_type_requirement): Stub.
862         (finish_constexpr_requirement): Stub.
863         (finish_noexcept_requirement): Stub.
864         (finish_requires_expr): Stub.
865         * gcc/cp/cp-tree.h: (finish_requires_expr): New.
866         (finish_syntax_requirement): New.
867         (finsih_type_requirement): New.
868         (finish_constexpr_requirement): New.
869         (finish_noexcept_requirement): New.
871 2013-06-21  Andrew Sutton  <andrew.n.sutton@gmail.com>
872         
873         * gcc/cp/error.c (subst_to_string): Allow this to be called explicitly
874         passing template parameters in the TREE_TYPE and with a null 
875         TREE_PURPOSE.
876         * constraint.cc (check_requirements): New overload taking template
877         arguments.
878         (check_constraints.cc): Move instantiation and checking into the
879         new check_requirements overload.
880         (diagnose_requirements): New family of functions for diagnosing 
881         constraint failures.
883 2013-06-18  Andrew Sutton  <andrew.n.sutton@gmail.com>
884         
885         * gcc/cp/class.c (are_constrained_member_overloads): New.
886         (add_method): Allow overloading of constrained member functions.
887         * gcc/cp/call.c (rejection_reason_code): New rr_constraint_failure.
888         (template_constraint_failure): New.
889         (add_function_candidate): Check for viability as a precondition to use.
890         (add_template_candidate_real): Integrate constraint diagnostics.
891         Provide constraint info for new template instantiations.
892         (print_z_candidate): Emit diagnostics for constraint failures.
893         (template_decl_for_candidate): New.
894         (joust): Allow non-member templates of class templates to be evaluated
895         in more_specialized_fn if they are constrained.
896         * gcc/cp/ptree.c (cxx_print_xnode): Dump constraint info.
897         * gcc/cp/semantics.c (finish_template_template_parm): Build template
898         info for template template parameters.
899         (is_unary_trait): New.
900         (is_binary_trait): New.
901         (finish_trait_expr): Check for binary traits using new function.
902         * gcc/cp/constraint.cc (join_requirements): New
903         (conjoin_requirements): Join expressions correctly. Fixed docs.
904         (disjoin_requirements): Removed.
905         (is_constriant): Removed.
906         (resolve_constraint_check): New. Replaces previous get_constraint
907         check and related functions.
908         (get_constraints): New, along with helper functions.
909         (suppress_template_processing): New. 
910         (check_template_constraints): New, along with helper functions.
911         (equivalent_constraints): New.
912         (equivalently_constrained): New.
913         (more_constraints): New.
914         (more_constrianed): New.
915         (diagnose_constraint_failure): New.
916         * gcc/cp/decl.c (decls_match): Check for constraint equivalence if
917         the types are the same.
918         (check_concept_refinement): New.
919         (are_constrained_overloads): New.
920         (duplicate_decls): Handle constraints for ambigous declarations. Check
921         and diagnose concept refinement.
922         (check_concept_fn): Don't fail completely just because the concept
923         isn't defined correctly. Allow analysis to continue as if declared
924         constexpr. Concepts must return bool.
925         * gcc/cp/tree.c (bind_template_template_parm): Provide empty 
926         constraints for bound template template parameters.
927         * gcc/cp/logic.cc: Rewrite of proof state and related structures and
928         decomposition logic. Removed right-decomposition logic, but retained
929         right-logical rules.
930         (match_terms): Renamed from entails.
931         (subsumes_prop): Cleanup, added specific handlers for and/or cases.
932         (subsumes_constraints): Update from interface change.
933         * gcc/cp/cp-tree.h (check_constraint_info): Renamed and applied
934         interface change.
935         (check_template_info): Renamed and applied interface change.
936         (cp_unevaluated): New
937         (local_specialization_stack): New.
938         (coerce_template_parms): New.
939         (is_unary_trait): New.
940         (is_binary_trait): New.
941         (get_constraints): New.
942         (check_constraints): New.
943         (check_template_constraints): New.
944         (subst_template_constraints): New.
945         (equivalent_constraints): New.
946         (equivalently_constrained): New.
947         (more_constraints): New.
948         (more_constrained): New.
949         (diagnose_constraints_failure): New.
950         * gcc/cp/cxx-pretty-print.c (pp_cxx_template_declaration): Print the
951         template requirements.
952         * gcc/cp/pt.c (local_specialization_stack): New.
953         (build_template_info): Refactor into 3-argument version and 
954         incorporate template requirements.
955         (check_explicit_specialization): Instantiate requirements for
956         template info.
957         (push_template_decl_real): Include constraints in template info.
958         (redeclare_class_template): Diagnose redeclaration with different
959         constraints.
960         (is_compatible_template_arg): New.
961         (convert_template_argument): Check constraints on template template
962         arguments and diagnose errors.
963         (lookup_template_class_1): Check constraints on alias templates.
964         Keep constraints with instantiated types.
965         (instantiate_class_template_1): Check constraints on class templates.
966         (tsubst_decl): Instantiate and keep constraints with template info.
967         Also, allow dependent pack arguments to produce neww parameter
968         packs when instantiated.
969         (coerce_template_parms): New overload.
970         (tsubst_copy): Handle REAL_TYPE and BOOLEAN_TYPE.
971         (tsubst_copy_and_build): PARM_DECLs can be instantiated as pack
972         expansions (used with requires expression).
973         (fn_type_unification): Check constraints for function templates.
974         (more_specialized_fn): Determine which candidate is more constrained.
975         (substitute_template_parameters): Removed.
976         (tsubst_constraint): New.
977         (substitute_requirements): New.
978         * gcc/cp/parser.c: (cp_parser_optional) Removed along with helper
979         functions, etc.
980         (cp_unevaluated): New.
981         (cp_parser_type_parameter): Check for requires kw explicitly, and
982         save/clear template requirements before parsing the requires clause.
983         (cp_parser_requires_clause): Removed.
984         (cp_parser_template_declaration_after_exp): Check for requires kw
985         explicitly.
986         * gcc/system.h (cstdlib): Removed include.
987         * gcc/c-family/c-common.h (D_CXX_CONCEPTS): New flag for disabling
988         concept keywords.
989         * gcc/c-family/c.opt (flag_concepts): Remove redundant declaration.
990         * gcc/c-family/c-common.c (c_common_r): Concept-specific keywords
991         are only enabled when concepts are enabled.
993 2013-06-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
995         * gcc/system.h (cstdlib): Include <cstdlib> to avoid poisoned
996         declaration errors.
997         * gcc/c-family/common.c (c_common_r): Added __is_same_as intrinsic,
998         removed previous, unused intrinsics.
999         * gcc/c-family/common.h (rid): Added RID_IS_SAME_AS.
1000         * gcc/cp/parser.c (take): New.
1001         (cp_requires_clause): New.
1002         (cp_requires_clause_opt): New.
1003         (cp_rule): New.
1004         (cp_parser_optional_if_token): New.
1005         (cp_parser_optional_if_not_token): New.
1006         (cp_parser_optional_if_keyword): New.
1007         (cp_parser_decl_specifier_seq): Parse 'concept' as a declspec.
1008         (cp_parser_type_parameter): Parse constrained template template parms.
1009         (cp_parser_member_specification_opt): Parse member constraints after
1010         the declaration, not before.
1011         (cp_parser_template_declaration_after_exp): Rewrote parsing for
1012         template requirements
1013         (cp_parser_late_parsing_for_member): Re-push the current template 
1014         requirements when late-parsing member definitions.
1015         * gcc/cp/decl.c (check_concept_fn): New.
1016         (grokfndecl): Semantics for concept declspec.
1017         (grokdeclarator): Semantics for concept declspec.
1018         (xref_tag_1): Update to new interface.
1019         * gcc/cp/constraint.cc (make_constraints): New.
1020         * gcc/cp/cp-objcp-common.c (cp_tree_size): Add case for constraint_info.
1021         * gcc/cp/cp-tree.h (require): New.
1022         (tree_template_info): Add a field for constraint info.
1023         (tree_constraint_info): New.
1024         (constraint_info_p): New.
1025         (template_info_p): New.
1026         (CI_SPELLING): New.
1027         (CI_REQUIREMENTS): New.
1028         (CI_ASSUMPTIONS): New.
1029         (TI_CONSTRAINT): New.
1030         (TI_SPELLING): New.
1031         (TI_REQUIREMENTS): New.
1032         (TI_ASSUMPTIONS): New.
1033         (DECL_TEMPLATE_CONSTRAINT): New.
1034         (CLASSTYPE_TEMPLATE_CONSTRAINT): New.
1035         (ENUM_TEMPLATE_CONSTRAINT): New.
1036         (TEMPLATE_TEMPLATE_PARM_TEMPLATE_CONSTRAINT): New.
1037         (TYPE_TEMPLATE_CONSTRAINT): New.
1038         (cp_tree_node_structure_enum): Added entry for constraint info.
1039         (lang_tree_node): Added entry for constraint info.
1040         (lang_decl_base): Added bit for concept declarations.
1041         (DECL_DECLARED_CONCEPT_P): New.
1042         (cp_decl_spec): Added ds_concept declaration specifier.
1043         * gcc/cp/Make-lang.in (logic.o): New target.
1044         * gcc/cp/semantics.c (finish_template_requirements): Rewrite.
1045         * gcc/cp/logic.cc: New
1046         * gcc/cp-tree.def (CONSTRAINT_INFO): New node.
1047         * gcc/cp/pt.c (current_template_args): Make non-static.
1048         (redeclare_class_template): Take constraints as a 3rd argument
1050 2013-04-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
1051         
1052         * gcc/cp/Make-lang.in: Add constraints.o target.
1053         * gcc/cp/cp-tree.h (substitute_template_parameters): Declare.
1054         (instantiate_requirements): Declare.
1055         (conjoin_requirements): Declare.
1056         (disjoin_requirements): Declare.
1057         (reduce_requirements): Declare.
1058         * gcc/cp/pt.c (substitute_template_parameters): Define.
1059         (instantiate_requirements): Define.
1060         * gcc/cp/pt.c (finish_template_requirements): Call
1061         reduce_requirements to get constraints.
1062         * gcc/cp/parser.c (cp_parser_type_parameter): Restore saved
1063         constraints after parsing template template parameter decl.
1064         * gcc/cp/constraints.cc: New.
1066 2013-03-11  Andrew Sutton  <andrew.n.sutton@gmail.com>
1067         
1068         * gcc/cp/Make-lang.in: Add constraint.c
1069         * gcc/cp/constraint.c: New
1070         (conjoin_requirements): New
1071         (disjoin_requirements): New
1072         (requirement_reduction): New class
1073         (reduce_requirements): New
1074         * gcc/cp/cp-tree.h (reduce_requrements): New
1075         (conjoin_requirements): New
1076         (disjoin_requirements): New
1077         * gcc/cp/cp-tree.h (finish_template_template_parm) Comments.
1078         * gcc/cp/semantics.c (finish_template_requirements) Start
1079         working with requirements.
1082 2013-03-01  Andrew Sutton  <andrew.n.sutton@gmail.com>
1084         * gcc/cp/cp-tree.h (saved_scope): Add template requirements.
1085         (finish_template_requirements): Declare
1086         * gcc/cp/parser.c (cp_parser_template_requirement_opt): Declare.
1087         (cp_parser_template_declaration): Document grammar extensions.
1088         (cp_parser_type_parameter): Parse requirements for template
1089         template parameters.
1090         (cp_parser_member_declaration): Parse requirements for
1091         members of class templates.
1092         (cp_parser_template_requirement_opt): Define.
1093         (cp_parser_template_declaration_after_exp): Parse requirements
1094         for template declarations.
1095         * gcc/cp/semantics.c (finish_template_requirements): Define.
1096         * gcc/cp/lex.c (cxx_init): Enable concepts by default.
1098 2013-03-01  Gabriel Dos Reis  <gdr@integrable-solutions.net>
1100         * lex.c (flag_concepts): Revert left over declaration.
1102 2013-03-01  Gabriel Dos Reis  <gdr@integrable-solutions.net>
1104         * gcc/c-family/c-common.c (cxx_dialect): Set C++11 as default.
1105         * gcc/c-family/c.opt(flag_concepts): Add.
1106         * gcc/cp/lex.c (flag_concepts): New.  Enabled concept support by
1107         default.
1109 2013-02-28  Andrew Sutton  <andrew.n.sutton@gmail.com>
1111         * gcc/c-family/c-common.h (rid): New resreserved words for concepts.
1112         * gcc/c-family/c-common.c (c_common_reswords): Definitions thereof.
1113         * gcc/doc/extend.texi (write_symbol): Initial concept docs.