+2018-08-27 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/63392
+ * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
+ hint.
+
2018-08-27 Jakub Jelinek <jakub@redhat.com>
PR c++/86993
else if (TYPE_P (parser->scope)
&& dependent_scope_p (parser->scope))
{
+ gcc_rich_location richloc (location);
+ richloc.add_fixit_insert_before ("typename ");
if (TREE_CODE (parser->scope) == TYPENAME_TYPE)
- error_at (location,
+ error_at (&richloc,
"need %<typename%> before %<%T::%D::%E%> because "
"%<%T::%D%> is a dependent scope",
TYPE_CONTEXT (parser->scope),
TYPE_CONTEXT (parser->scope),
TYPENAME_TYPE_FULLNAME (parser->scope));
else
- error_at (location, "need %<typename%> before %<%T::%E%> because "
+ error_at (&richloc, "need %<typename%> before %<%T::%E%> because "
"%qT is a dependent scope",
parser->scope, id, parser->scope);
}
+2018-08-27 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/63392
+ * g++.dg/diagnostic/missing-typename.C: New test.
+
2018-08-27 Jeff Law <law@redhat.com>
* gcc.c-torture/compile/dse.c: New test.
--- /dev/null
+// fix-it hint for missing "typename" (PR c++/63392)
+// { dg-options "-fdiagnostics-show-caret" }
+
+template<typename T>
+class test_1 {
+ T::type x; // { dg-error "need 'typename' before 'T::type' because 'T' is a dependent scope" }
+ /* { dg-begin-multiline-output "" }
+ T::type x;
+ ^
+ typename
+ { dg-end-multiline-output "" } */
+};