diff options
author | Jason Merrill <jason@redhat.com> | 2009-06-09 00:18:54 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-06-09 00:18:54 -0400 |
commit | 3dbbb7af5b4dd3ae01a9347081f4b486d3752160 (patch) | |
tree | b7e0fcb69c34f807be32cbe3b5ca5c32518d8e1c /gcc/cp | |
parent | 92b672095e73e4f09750f5f5b010ecabc1e001c4 (diff) | |
download | gcc-3dbbb7af5b4dd3ae01a9347081f4b486d3752160.zip gcc-3dbbb7af5b4dd3ae01a9347081f4b486d3752160.tar.gz gcc-3dbbb7af5b4dd3ae01a9347081f4b486d3752160.tar.bz2 |
parser.c (cp_parser_type_id_1): 'auto' type is ok with a late-specified return type.
* parser.c (cp_parser_type_id_1): 'auto' type is ok with a
late-specified return type.
From-SVN: r148306
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/parser.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d9327a9..c4e84aa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2009-06-08 Jason Merrill <jason@redhat.com> + + * parser.c (cp_parser_type_id_1): 'auto' type is ok with a + late-specified return type. + 2009-06-08 Jakub Jelinek <jakub@redhat.com> PR c++/40373 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 05ae257..b988850 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -13848,8 +13848,17 @@ cp_parser_type_id_1 (cp_parser* parser, bool is_template_arg) if (type_specifier_seq.type && type_uses_auto (type_specifier_seq.type)) { - error ("invalid use of %<auto%>"); - return error_mark_node; + /* A type-id with type 'auto' is only ok if the abstract declarator + is a function declarator with a late-specified return type. */ + if (abstract_declarator + && abstract_declarator->kind == cdk_function + && abstract_declarator->u.function.late_return_type) + /* OK */; + else + { + error ("invalid use of %<auto%>"); + return error_mark_node; + } } return groktypename (&type_specifier_seq, abstract_declarator, |