Commit 22235619 by Paolo Carlini Committed by Paolo Carlini

re PR c++/62315 (do not print typename in diagnostic if the original code does not have it)

/cp
2017-06-24  Paolo Carlini  <paolo.carlini@oracle.com>

	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  <paolo.carlini@oracle.com>

	PR c++/62315
	* g++.dg/parse/typedef2.C: Specify a dg-error string.

From-SVN: r249626
parent e56e3fda
2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
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 <jason@redhat.com>
PR c++/79056 - C++17 ICE with invalid template syntax.
......
......@@ -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 %<typename%> 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 %<typename%> 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 %<typename%> 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))
2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62315
* g++.dg/parse/typedef2.C: Specify a dg-error string.
2017-06-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/52473
......
template <typename T> struct B { typedef typename T::X X; };
template <typename T> struct A { typedef B<T>::X::Y Z; }; // { dg-error "" }
template <typename T> struct A { typedef B<T>::X::Y Z; }; // { dg-error "before 'B<T>::X::Y' because 'B<T>::X'" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment