summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/parser.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr59110.C2
3 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 99a71fbbb73..140f53eb64d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 71a2a9ed1c5..572528358f5 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr59110.C b/gcc/testsuite/g++.dg/cpp1y/pr59110.C
index dbbfa9b41de..5c9c20879ad 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr59110.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr59110.C
@@ -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 "" }
OpenPOWER on IntegriCloud