parser.c (cp_parser_type_id_1): Only allow 'auto' in C++1y if we're in a trailing return type.

* parser.c (cp_parser_type_id_1): Only allow 'auto' in C++1y if
	we're in a trailing return type.

From-SVN: r208415
This commit is contained in:
Jason Merrill 2014-03-07 15:00:36 -05:00 committed by Jason Merrill
parent d08a068b5e
commit 968b350374
3 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2014-03-07 Jason Merrill <jason@redhat.com>
* parser.c (cp_parser_type_id_1): Only allow 'auto' in C++1y if
we're in a trailing return type.
* typeck.c (comp_template_parms_position): 'auto' and
'decltype(auto)' are different from real template parms.

View File

@ -17992,7 +17992,9 @@ cp_parser_type_id_1 (cp_parser* parser, bool is_template_arg,
abstract_declarator = NULL;
if (type_specifier_seq.type
&& cxx_dialect < cxx1y
/* None of the valid uses of 'auto' in C++14 involve the type-id
nonterminal, but it is valid in a trailing-return-type. */
&& !(cxx_dialect >= cxx1y && is_trailing_return)
&& type_uses_auto (type_specifier_seq.type))
{
/* A type-id with type 'auto' is only ok if the abstract declarator

View File

@ -1,4 +1,4 @@
// PR c++/59110
// { dg-options "-std=c++1y" }
int i = *(auto*)0; // { dg-error "cannot convert" }
int i = *(auto*)0; // { dg-error "" }