aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-12-18 18:53:15 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-12-18 18:53:15 -0500
commit90f6debee40951552f873164d332f7a46b1007df (patch)
treee70297ceaaaf71027af512f84629eaa652d6ad21 /gcc/cp
parent18d27358a51ac42c918be18eff0d24ba0b1ef52a (diff)
downloadgcc-90f6debee40951552f873164d332f7a46b1007df.zip
gcc-90f6debee40951552f873164d332f7a46b1007df.tar.gz
gcc-90f6debee40951552f873164d332f7a46b1007df.tar.bz2
re PR c++/64105 (ICE: in strip_typedefs, at cp/tree.c:1326)
PR c++/64105 * parser.c (cp_parser_simple_type_specifier): Make auto parameter before -std=c++14 an error. From-SVN: r218879
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c14
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c80690d..823f086 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2014-12-18 Jason Merrill <jason@redhat.com>
+ PR c++/64105
+ * parser.c (cp_parser_simple_type_specifier): Make auto parameter
+ before -std=c++14 an error.
+
PR c++/64352
* pt.c (tsubst_copy_and_build): Pass complain to mark_used.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 0e7ba7a..8ff16ed 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14862,23 +14862,26 @@ cp_parser_simple_type_specifier (cp_parser* parser,
maybe_warn_cpp0x (CPP0X_AUTO);
if (parser->auto_is_implicit_function_template_parm_p)
{
- type = synthesize_implicit_template_parm (parser);
+ if (cxx_dialect >= cxx14)
+ type = synthesize_implicit_template_parm (parser);
+ else
+ type = error_mark_node;
if (current_class_type && LAMBDA_TYPE_P (current_class_type))
{
if (cxx_dialect < cxx14)
- pedwarn (location_of (type), 0,
+ error_at (token->location,
"use of %<auto%> in lambda parameter declaration "
"only available with "
"-std=c++14 or -std=gnu++14");
}
else if (cxx_dialect < cxx14)
- pedwarn (location_of (type), 0,
+ error_at (token->location,
"use of %<auto%> in parameter declaration "
"only available with "
"-std=c++14 or -std=gnu++14");
else
- pedwarn (location_of (type), OPT_Wpedantic,
+ pedwarn (token->location, OPT_Wpedantic,
"ISO C++ forbids use of %<auto%> in parameter "
"declaration");
}
@@ -14971,6 +14974,9 @@ cp_parser_simple_type_specifier (cp_parser* parser,
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
+ if (type == error_mark_node)
+ return error_mark_node;
+
/* There is no valid C++ program where a non-template type is
followed by a "<". That usually indicates that the user thought
that the type was a template. */