aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2013-05-03 09:02:15 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-05-03 09:02:15 +0000
commitc067d9fe141912636b9d757fbd83ce7d73300bfe (patch)
tree764662553646f9fc5bafdadec4e3dcda62ec1f92 /gcc/cp/parser.c
parent79d944d29618c459e8470715ed0a38a0f2891c50 (diff)
downloadgcc-c067d9fe141912636b9d757fbd83ce7d73300bfe.zip
gcc-c067d9fe141912636b9d757fbd83ce7d73300bfe.tar.gz
gcc-c067d9fe141912636b9d757fbd83ce7d73300bfe.tar.bz2
re PR c++/14283 (Diagnostic for invalid template-id could be improved)
/cp 2013-05-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/14283 * parser.c (cp_parser_diagnose_invalid_type_name): Improve error messages for template types and fix column numbers. /testsuite 2013-05-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/14283 * g++.dg/parse/error51.C: New. * g++.dg/parse/error15.C: Adjust column numbers. From-SVN: r198572
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 2239a07..f87974e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2872,8 +2872,16 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
else if (parser->scope != error_mark_node)
{
if (TREE_CODE (parser->scope) == NAMESPACE_DECL)
- error_at (location, "%qE in namespace %qE does not name a type",
- id, parser->scope);
+ {
+ if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
+ error_at (location_of (id),
+ "%qE in namespace %qE does not name a template type",
+ id, parser->scope);
+ else
+ error_at (location_of (id),
+ "%qE in namespace %qE does not name a type",
+ id, parser->scope);
+ }
else if (CLASS_TYPE_P (parser->scope)
&& constructor_name_p (id, parser->scope))
{
@@ -2890,8 +2898,16 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
"%qT is a dependent scope",
parser->scope, id, parser->scope);
else if (TYPE_P (parser->scope))
- error_at (location, "%qE in %q#T does not name a type",
- id, parser->scope);
+ {
+ if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
+ error_at (location_of (id),
+ "%qE in %q#T does not name a template type",
+ id, parser->scope);
+ else
+ error_at (location_of (id),
+ "%qE in %q#T does not name a type",
+ id, parser->scope);
+ }
else
gcc_unreachable ();
}