From: paolo Date: Sat, 24 Jun 2017 19:31:24 +0000 (+0000) Subject: /cp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56e5cf36dea99da5e8e6a9a8fda363a7207c43ca;p=thirdparty%2Fgcc.git /cp 2017-06-24 Paolo Carlini PR c++/62315 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print 'typename' in error messages about missing 'typename'. /testsuite 2017-06-24 Paolo Carlini PR c++/62315 * g++.dg/parse/typedef2.C: Specify a dg-error string. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249626 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2d590a5d66f0..a06de8ba8c73 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-06-24 Paolo Carlini + + PR c++/62315 + * parser.c (cp_parser_diagnose_invalid_type_name): Don't print + 'typename' in error messages about missing 'typename'. + 2017-06-23 Jason Merrill PR c++/79056 - C++17 ICE with invalid template syntax. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 97cd9237bf20..634047e5d05d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3272,9 +3272,21 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree id, } else if (TYPE_P (parser->scope) && dependent_scope_p (parser->scope)) - error_at (location, "need % before %<%T::%E%> because " - "%qT is a dependent scope", - parser->scope, id, parser->scope); + { + if (TREE_CODE (parser->scope) == TYPENAME_TYPE) + error_at (location, + "need % before %<%T::%D::%E%> because " + "%<%T::%D%> is a dependent scope", + TYPE_CONTEXT (parser->scope), + TYPENAME_TYPE_FULLNAME (parser->scope), + id, + TYPE_CONTEXT (parser->scope), + TYPENAME_TYPE_FULLNAME (parser->scope)); + else + error_at (location, "need % before %<%T::%E%> because " + "%qT is a dependent scope", + parser->scope, id, parser->scope); + } else if (TYPE_P (parser->scope)) { if (!COMPLETE_TYPE_P (parser->scope)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eefa2c477155..ad5ccb7dc64a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-24 Paolo Carlini + + PR c++/62315 + * g++.dg/parse/typedef2.C: Specify a dg-error string. + 2017-06-24 Thomas Koenig PR fortran/52473 diff --git a/gcc/testsuite/g++.dg/parse/typedef2.C b/gcc/testsuite/g++.dg/parse/typedef2.C index 3ae347d75427..1cc1ea0d58ff 100644 --- a/gcc/testsuite/g++.dg/parse/typedef2.C +++ b/gcc/testsuite/g++.dg/parse/typedef2.C @@ -1,3 +1,2 @@ template struct B { typedef typename T::X X; }; -template struct A { typedef B::X::Y Z; }; // { dg-error "" } - +template struct A { typedef B::X::Y Z; }; // { dg-error "before 'B::X::Y' because 'B::X'" }