aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-10-15 16:47:52 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-10-15 16:47:52 +0000
commit81833173943fec6dec7287b475303e9d22387386 (patch)
tree16c3380243320131ca2a9104b161a01a40c0cd8a /gcc/cp
parent308a3fe2b9afc954a494c9d4e0092fb11adcd8ef (diff)
downloadgcc-81833173943fec6dec7287b475303e9d22387386.zip
gcc-81833173943fec6dec7287b475303e9d22387386.tar.gz
gcc-81833173943fec6dec7287b475303e9d22387386.tar.bz2
re PR c++/50080 ([DR 468] error: 'template' (as a disambiguator) is only allowed within templates)
/cp 2012-10-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50080 * parser.c (cp_parser_optional_template_keyword): Implement Core/468, allow outside template. /testsuite 2012-10-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50080 * g++.dg/parse/tmpl-outside2.C: New. * g++.dg/parse/tmpl-outside1.C: Adjust. * g++.dg/template/qualttp18.C: Likewise. * g++.old-deja/g++.pt/memtemp87.C: Likewise. * g++.old-deja/g++.pt/overload13.C: Likewise. From-SVN: r192465
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c25
2 files changed, 9 insertions, 22 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6621c11..5239e7e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50080
+ * parser.c (cp_parser_optional_template_keyword): Implement
+ Core/468, allow outside template.
+
2012-10-14 Jason Merrill <jason@redhat.com>
Ville Voutilainen <ville.voutilainen@gmail.com>
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index a7939c8..965bc62 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -23252,29 +23252,10 @@ cp_parser_optional_template_keyword (cp_parser *parser)
{
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE))
{
- /* The `template' keyword can only be used within templates;
- outside templates the parser can always figure out what is a
- template and what is not. */
- if (!processing_template_decl)
- {
- cp_token *token = cp_lexer_peek_token (parser->lexer);
- error_at (token->location,
- "%<template%> (as a disambiguator) is only allowed "
- "within templates");
- /* If this part of the token stream is rescanned, the same
- error message would be generated. So, we purge the token
- from the stream. */
- cp_lexer_purge_token (parser->lexer);
- return false;
- }
- else
- {
- /* Consume the `template' keyword. */
- cp_lexer_consume_token (parser->lexer);
- return true;
- }
+ /* Consume the `template' keyword. */
+ cp_lexer_consume_token (parser->lexer);
+ return true;
}
-
return false;
}