aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cxx-pretty-print.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-10-31 12:20:05 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-10-31 12:20:05 -0400
commit4fea442db740d66cd8d16bdeb667d9725f305844 (patch)
tree58ced5bf7feb8ee0c6ac2b1c7d216ad00966909d /gcc/cp/cxx-pretty-print.c
parenta459b07fa440fcb449e9b65cf0cc649905b6ba9e (diff)
downloadgcc-4fea442db740d66cd8d16bdeb667d9725f305844.zip
gcc-4fea442db740d66cd8d16bdeb667d9725f305844.tar.gz
gcc-4fea442db740d66cd8d16bdeb667d9725f305844.tar.bz2
Implement multiple 'auto' feature from Concepts TS.
* parser.c (cp_parser_type_id_1): Allow 'auto' if -fconcepts. (cp_parser_template_type_arg): Likewise. (get_concept_from_constraint): Split out most logic to... * constraint.cc (placeholder_extract_concept_and_args): ...here. (equivalent_placeholder_constraints, hash_placeholder_constraint): New. * cxx-pretty-print.c (pp_cxx_constrained_type_spec): New. * cxx-pretty-print.h: Declare it. * error.c (dump_type) [TEMPLATE_TYPE_PARM]: Call it. * pt.c (is_auto_r, extract_autos_r, extract_autos, auto_hash): New. (type_uses_auto): Use is_auto_r. (do_auto_deduction): Handle multiple 'auto's if -fconcepts. * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Compare constraints. From-SVN: r229629
Diffstat (limited to 'gcc/cp/cxx-pretty-print.c')
-rw-r--r--gcc/cp/cxx-pretty-print.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index ea6b4c5..72bbfc5 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -2195,6 +2195,26 @@ pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm)
pp_cxx_end_template_argument_list (pp);
}
+/* Print a constrained-type-specifier. */
+
+void
+pp_cxx_constrained_type_spec (cxx_pretty_printer *pp, tree c)
+{
+ tree t, a;
+ placeholder_extract_concept_and_args (c, t, a);
+ pp->id_expression (t);
+ if (TREE_VEC_LENGTH (a) > 1)
+ {
+ pp_cxx_begin_template_argument_list (pp);
+ tree args = make_tree_vec (TREE_VEC_LENGTH (a) - 1);
+ for (int i = TREE_VEC_LENGTH (a) - 1; i > 0; --i)
+ TREE_VEC_ELT (args, i-1) = TREE_VEC_ELT (a, i);
+ pp_cxx_template_argument_list (pp, args);
+ ggc_free (args);
+ pp_cxx_end_template_argument_list (pp);
+ }
+}
+
/*
template-declaration:
export(opt) template < template-parameter-list > declaration