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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198572
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
+
2013-05-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57132
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))
{
"%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 ();
}
+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.
+
2013-05-02 Tobias Burnus <burnus@net-b.de>
PR fortran/57142
}
N::A f2; // { dg-error "1:invalid use of template-name 'N::A' without an argument list" }
-N::INVALID f3; // { dg-error "1:'INVALID' in namespace 'N' does not name a type" }
-N::C::INVALID f4; // { dg-error "1:'INVALID' in 'struct N::C' does not name a type" }
-N::K f6; // { dg-error "1:'K' in namespace 'N' does not name a type" }
+N::INVALID f3; // { dg-error "4:'INVALID' in namespace 'N' does not name a type" }
+N::C::INVALID f4; // { dg-error "7:'INVALID' in 'struct N::C' does not name a type" }
+N::K f6; // { dg-error "4:'K' in namespace 'N' does not name a type" }
typename N::A f7;
// { dg-error "13:invalid use of template-name 'N::A' without an argument list" "13" { target *-*-* } 17 }
// { dg-error "17:invalid type in declaration before ';' token" "17" { target *-*-* } 17 }
struct B
{
N::A f2; // { dg-error "3:invalid use of template-name 'N::A' without an argument list" }
- N::INVALID f3; // { dg-error "3:'INVALID' in namespace 'N' does not name a type" }
- N::C::INVALID f4; // { dg-error "3:'INVALID' in 'struct N::C' does not name a type" }
- N::K f6; // { dg-error "3:'K' in namespace 'N' does not name a type" }
+ N::INVALID f3; // { dg-error "6:'INVALID' in namespace 'N' does not name a type" }
+ N::C::INVALID f4; // { dg-error "9:'INVALID' in 'struct N::C' does not name a type" }
+ N::K f6; // { dg-error "6:'K' in namespace 'N' does not name a type" }
typename N::A f7;
// { dg-error "15:invalid use of template-name 'N::A' without an argument list" "15" { target *-*-* } 27 }
};
struct C
{
N::A f2; // { dg-error "3:invalid use of template-name 'N::A' without an argument list" }
- N::INVALID f3; // { dg-error "3:'INVALID' in namespace 'N' does not name a type" }
- N::C::INVALID f4; // { dg-error "3:'INVALID' in 'struct N::C' does not name a type" }
- N::K f6; // { dg-error "3:'K' in namespace 'N' does not name a type" }
+ N::INVALID f3; // { dg-error "6:'INVALID' in namespace 'N' does not name a type" }
+ N::C::INVALID f4; // { dg-error "9:'INVALID' in 'struct N::C' does not name a type" }
+ N::K f6; // { dg-error "6:'K' in namespace 'N' does not name a type" }
typename N::A f7; // { dg-error "15:invalid use of template-name 'N::A' without an argument list" }
};
--- /dev/null
+// PR c++/14283
+
+struct A
+{};
+
+namespace N
+{}
+
+template <typename> struct C
+{
+ typedef A::template INVALID<void> X0; // { dg-error "23:'INVALID' in 'struct A' does not name a template type" }
+ typedef N::template INVALID<void> X1; // { dg-error "23:'INVALID' in namespace 'N' does not name a template type" }
+};