summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-16 12:29:40 +0000
committergiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-16 12:29:40 +0000
commit9591b260f09cc6c0cda7525e23b249042a86c25a (patch)
treec9e198d82185c6ce3465c02f8638403dfcb7c758
parent18f811c97247140eac1b512edb00e72ccf44d3d7 (diff)
downloadppe42-gcc-9591b260f09cc6c0cda7525e23b249042a86c25a.tar.gz
ppe42-gcc-9591b260f09cc6c0cda7525e23b249042a86c25a.zip
PR c++/13407
* parser.c (cp_parser_base_specifier): Check for an invalid keyword 'typename' and emit an user-friendly error message. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75969 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c12
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f78d9af6f23..a902c255768 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/13407
+ * parser.c (cp_parser_base_specifier): Check for an invalid
+ keyword `typename' and emit an user-friendly error message.
+
2004-01-15 Geoffrey Keating <geoffk@apple.com>
PR pch/13361
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6a78264421a..481864b1095 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12690,6 +12690,18 @@ cp_parser_base_specifier (cp_parser* parser)
break;
}
}
+ /* It is not uncommon to see programs mechanically, errouneously, use
+ the 'typename' keyword to denote (dependent) qualified types
+ as base classes. */
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
+ {
+ if (!processing_template_decl)
+ error ("keyword `typename' not allowed outside of templates");
+ else
+ error ("keyword `typename' not allowed in this context "
+ "(the base class is implicitly a type)");
+ cp_lexer_consume_token (parser->lexer);
+ }
/* Look for the optional `::' operator. */
cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false);
OpenPOWER on IntegriCloud