diff options
author | Jason Merrill <jason@redhat.com> | 2008-09-01 03:33:19 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2008-09-01 03:33:19 +0000 |
commit | 5ab4d4ad7c5536b54982f08c7bf42b2c8a72740a (patch) | |
tree | 4df2798ed30c19a13c03271ee6b5b653821b5353 /gcc/cp/pt.c | |
parent | 0227223652e623c4b6b4bd12dc6f4209d2fa24d6 (diff) |
Implement late-specified return type using 'auto'.
* cp-tree.h (struct cp_declarator): Add late_return_type field to
function declarator.
* parser.c (cp_parser_late_return_type_opt): New fn.
(cp_parser_direct_declarator): Use it.
(make_call_declarator): Put it in the declarator.
* decl.c (grokdeclarator): Splice in late-specified return type.
* pt.c (splice_late_return_type): New fn.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@139848 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5bb18d99e88..b05c7a00ec2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -16769,6 +16769,23 @@ do_auto_deduction (tree type, tree init, tree auto_node) return tsubst (type, targs, tf_warning_or_error, NULL_TREE); } +/* Substitutes LATE_RETURN_TYPE for 'auto' in TYPE and returns the + result. */ + +tree +splice_late_return_type (tree type, tree late_return_type) +{ + tree argvec; + + if (late_return_type == NULL_TREE) + return type; + argvec = make_tree_vec (1); + TREE_VEC_ELT (argvec, 0) = late_return_type; + if (processing_template_decl) + argvec = add_to_template_args (current_template_args (), argvec); + return tsubst (type, argvec, tf_warning_or_error, NULL_TREE); +} + /* Returns true iff TYPE is a TEMPLATE_TYPE_PARM representing 'auto'. */ bool |