diff options
author | Adam Butcher <abutcher@gcc.gnu.org> | 2013-09-16 08:14:34 +0100 |
---|---|---|
committer | Adam Butcher <abutcher@gcc.gnu.org> | 2013-09-16 08:14:34 +0100 |
commit | 1a11a94fcd9cfe0759f6e37cac0177982697e45a (patch) | |
tree | 7b1d4ac4d3e611d0294babd60fb9894821a0f303 /gcc/cp/parser.h | |
parent | 6a8b219b44bba840fed7e0994a70a60322a29e59 (diff) | |
download | gcc-1a11a94fcd9cfe0759f6e37cac0177982697e45a.zip gcc-1a11a94fcd9cfe0759f6e37cac0177982697e45a.tar.gz gcc-1a11a94fcd9cfe0759f6e37cac0177982697e45a.tar.bz2 |
Support using 'auto' in a function parameter list to introduce an implicit template parameter.
gcc/cp/
* cp-tree.h (type_uses_auto_or_concept): Declare.
(is_auto_or_concept): Declare.
* decl.c (grokdeclarator): Allow 'auto' parameters in lambdas with
-std=gnu++1y or -std=c++1y or, as a GNU extension, in plain functions.
* type-utils.h: New header defining ...
(find_type_usage): ... this new function based on pt.c (type_uses_auto)
for searching a type tree given a predicate.
* pt.c (type_uses_auto): Reimplement via type-utils.h (find_type_usage).
(is_auto_or_concept): New function.
(type_uses_auto_or_concept): New function.
* parser.h (struct cp_parser): Add fully_implicit_function_template_p.
* parser.c (cp_parser_new): Initialize fully_implicit_function_template_p.
(cp_parser_new): Initialize fully_implicit_function_template_p.
(cp_parser_lambda_expression): Copy and restore value of
fully_implicit_function_template_p as per other parser fields.
(cp_parser_parameter_declaration_list): Count generic
parameters and call ...
(add_implicit_template_parms): ... this new function to synthesize them
with help from type-utils.h (find_type_usage), ...
(tree_type_is_auto_or_concept): ... this new static function and ...
(make_generic_type_name): ... this new static function.
(cp_parser_direct_declarator): Account for implicit template parameters.
(cp_parser_lambda_declarator_opt): Finish fully implicit template if
necessary by calling ...
(finish_fully_implicit_template): ... this new function.
(cp_parser_init_declarator): Likewise.
(cp_parser_function_definition_after_declarator): Likewise.
(cp_parser_member_declaration): Likewise.
* Make-lang.in (cp/pt.o): Add dependency on type-utils.h.
(cp/parser.o): Likewise.
gcc/testsuite/
g++.dg/cpp0x/auto9.C: Downgrade two previously expected errors (now
interpreted as implicit templates) to be expected pedwarns instead.
From-SVN: r202612
Diffstat (limited to 'gcc/cp/parser.h')
-rw-r--r-- | gcc/cp/parser.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h index 3d8bb74..ffdddaf 100644 --- a/gcc/cp/parser.h +++ b/gcc/cp/parser.h @@ -341,6 +341,12 @@ typedef struct GTY(()) cp_parser { /* The number of template parameter lists that apply directly to the current declaration. */ unsigned num_template_parameter_lists; + + /* TRUE if the function being declared was made a template due to its + parameter list containing generic type specifiers (`auto' or concept + identifiers) rather than an explicit template parameter list. */ + bool fully_implicit_function_template_p; + } cp_parser; /* In parser.c */ |