This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ diagnostics: Use quoting flag q (5/n)
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: 05 Oct 2004 08:38:12 -0500
- Subject: C++ diagnostics: Use quoting flag q (5/n)
- Organization: Texas A&M University, Department of Computer Science
Bootstrapped and regtested on i686-pc-linux-gnu.
cp/
2004-10-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 5/n
* parser.c (cp_parser_name_lookup_error,
cp_parser_diagnose_invalid_type_name,
cp_parser_primary_expression, cp_parser_unqualified_id,
cp_parser_nested_name_specifier_opt, cp_parser_labeled_statement,
cp_parser_jump_statement, cp_parser_simple_declaration,
cp_parser_decl_specifier_seq, cp_parser_mem_initializer_id,
cp_parser_type_parameter, cp_parser_template_id,
cp_parser_template_name, cp_parser_direct_declarator,
cp_parser_parameter_declaration_list, cp_parser_class_head,
cp_parser_base_specifier, cp_parser_lookup_name,
cp_parser_late_parsing_default_args,
cp_parser_optional_template_keyword
cp_parser_elaborated_type_specifier, cp_parser_check_class_key,
cp_parser_check_access_in_redeclaration): Use quoting marks.
* name-lookup.c (supplement_binding, pushdecl,
check_for_out_of_scope_variable, validate_nonmember_using_decl,
do_nonmember_using_decl, lookup_tag, set_decl_namespace,
push_namespace, do_namespace_alias, do_using_directive,
ambiguous_decl, lookup_namespace_name, add_function): Likewise.
* method.c (use_thunk): Likewise.
* lex.c (unqualified_name_lookup_error,
unqualified_fn_lookup_error): Likewise.
testsuite/
2004-10-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
* g++.dg/other/classkey1.C: Adjust quoting marks.
* g++.dg/parse/error15.C: Likewise.
* g++.dg/template/meminit2.C (int>): Likewise.
Index: lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.c,v
retrieving revision 1.349
diff -p -r1.349 lex.c
*** lex.c 22 Sep 2004 10:55:21 -0000 1.349
--- lex.c 5 Oct 2004 12:40:07 -0000
*************** unqualified_name_lookup_error (tree name
*** 566,576 ****
if (IDENTIFIER_OPNAME_P (name))
{
if (name != ansi_opname (ERROR_MARK))
! error ("`%D' not defined", name);
}
else
{
! error ("`%D' was not declared in this scope", name);
/* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */
if (current_function_decl)
--- 566,576 ----
if (IDENTIFIER_OPNAME_P (name))
{
if (name != ansi_opname (ERROR_MARK))
! error ("%qD not defined", name);
}
else
{
! error ("%qD was not declared in this scope", name);
/* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */
if (current_function_decl)
*************** unqualified_fn_lookup_error (tree name)
*** 607,614 ****
Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */
! pedwarn ("there are no arguments to `%D' that depend on a template "
! "parameter, so a declaration of `%D' must be available",
name, name);
if (!flag_permissive)
--- 607,614 ----
Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */
! pedwarn ("there are no arguments to %qD that depend on a template "
! "parameter, so a declaration of %qD must be available",
name, name);
if (!flag_permissive)
Index: method.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/method.c,v
retrieving revision 1.315
diff -p -r1.315 method.c
*** method.c 10 Sep 2004 23:56:31 -0000 1.315
--- method.c 5 Oct 2004 12:40:07 -0000
*************** use_thunk (tree thunk_fndecl, bool emit_
*** 440,446 ****
doesn't work for varargs. */
if (varargs_function_p (function))
! error ("generic thunk code fails for method `%#D' which uses `...'",
function);
DECL_RESULT (thunk_fndecl) = NULL_TREE;
--- 440,446 ----
doesn't work for varargs. */
if (varargs_function_p (function))
! error ("generic thunk code fails for method %q#D which uses %<...%>",
function);
DECL_RESULT (thunk_fndecl) = NULL_TREE;
*************** do_build_assign_ref (tree fndecl)
*** 649,660 ****
if (CP_TYPE_CONST_P (TREE_TYPE (field)))
{
! error ("non-static const member `%#D', can't use default assignment operator", field);
continue;
}
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
{
! error ("non-static reference member `%#D', can't use default assignment operator", field);
continue;
}
--- 649,662 ----
if (CP_TYPE_CONST_P (TREE_TYPE (field)))
{
! error ("non-static const member %q#D, can't use default "
! "assignment operator", field);
continue;
}
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
{
! error ("non-static reference member %q#D, can't use "
! "default assignment operator", field);
continue;
}
Index: name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.85
diff -p -r1.85 name-lookup.c
*** name-lookup.c 30 Aug 2004 16:03:45 -0000 1.85
--- name-lookup.c 5 Oct 2004 12:40:09 -0000
*************** supplement_binding (cxx_binding *binding
*** 574,581 ****
ok = false;
else
{
! error ("declaration of `%#D'", decl);
! cp_error_at ("conflicts with previous declaration `%#D'", bval);
ok = false;
}
--- 574,581 ----
ok = false;
else
{
! error ("declaration of %q#D", decl);
! cp_error_at ("conflicts with previous declaration %q#D", bval);
ok = false;
}
*************** pushdecl (tree x)
*** 759,766 ****
else if (t == wchar_decl_node)
{
if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
! pedwarn ("redeclaration of `wchar_t' as `%T'",
! TREE_TYPE (x));
/* Throw away the redeclaration. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
--- 759,766 ----
else if (t == wchar_decl_node)
{
if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
! pedwarn ("redeclaration of %<wchar_t%> as %qT",
! TREE_TYPE (x));
/* Throw away the redeclaration. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
*************** pushdecl (tree x)
*** 791,798 ****
[basic.start.main]
This function shall not be overloaded. */
! cp_error_at ("invalid redeclaration of `%D'", t);
! error ("as `%D'", x);
/* We don't try to push this declaration since that
causes a crash. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
--- 791,798 ----
[basic.start.main]
This function shall not be overloaded. */
! cp_error_at ("invalid redeclaration of %qD", t);
! error ("as %qD", x);
/* We don't try to push this declaration since that
causes a crash. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
*************** pushdecl (tree x)
*** 880,887 ****
&& TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{
! pedwarn ("type mismatch with previous external decl of `%#D'", x);
! cp_pedwarn_at ("previous external decl of `%#D'", decl);
}
}
--- 880,887 ----
&& TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{
! pedwarn ("type mismatch with previous external decl of %q#D", x);
! cp_pedwarn_at ("previous external decl of %q#D", decl);
}
}
*************** pushdecl (tree x)
*** 963,970 ****
/* OK */;
else
{
! warning ("extern declaration of `%#D' doesn't match", x);
! cp_warning_at ("global declaration `%#D'", oldglobal);
}
}
/* If we have a local external declaration,
--- 963,970 ----
/* OK */;
else
{
! warning ("extern declaration of %q#D doesn't match", x);
! cp_warning_at ("global declaration %q#D", oldglobal);
}
}
/* If we have a local external declaration,
*************** pushdecl (tree x)
*** 1000,1013 ****
/* ARM $8.3 */
if (b->kind == sk_function_parms)
{
! error ("declaration of '%#D' shadows a parameter", x);
err = true;
}
}
if (warn_shadow && !err)
{
! warning ("declaration of '%#D' shadows a parameter", x);
warning ("%Jshadowed declaration is here", oldlocal);
}
}
--- 1000,1013 ----
/* ARM $8.3 */
if (b->kind == sk_function_parms)
{
! error ("declaration of %q#D shadows a parameter", x);
err = true;
}
}
if (warn_shadow && !err)
{
! warning ("declaration of %q#D shadows a parameter", x);
warning ("%Jshadowed declaration is here", oldlocal);
}
}
*************** pushdecl (tree x)
*** 1032,1051 ****
if (member && !TREE_STATIC (member))
{
/* Location of previous decl is not useful in this case. */
! warning ("declaration of '%D' shadows a member of 'this'",
x);
}
else if (oldlocal != NULL_TREE
&& TREE_CODE (oldlocal) == VAR_DECL)
{
! warning ("declaration of '%D' shadows a previous local", x);
warning ("%Jshadowed declaration is here", oldlocal);
}
else if (oldglobal != NULL_TREE
&& TREE_CODE (oldglobal) == VAR_DECL)
/* XXX shadow warnings in outer-more namespaces */
{
! warning ("declaration of '%D' shadows a global declaration",
x);
warning ("%Jshadowed declaration is here", oldglobal);
}
--- 1032,1051 ----
if (member && !TREE_STATIC (member))
{
/* Location of previous decl is not useful in this case. */
! warning ("declaration of %qD shadows a member of 'this'",
x);
}
else if (oldlocal != NULL_TREE
&& TREE_CODE (oldlocal) == VAR_DECL)
{
! warning ("declaration of %qD shadows a previous local", x);
warning ("%Jshadowed declaration is here", oldlocal);
}
else if (oldglobal != NULL_TREE
&& TREE_CODE (oldglobal) == VAR_DECL)
/* XXX shadow warnings in outer-more namespaces */
{
! warning ("declaration of %qD shadows a global declaration",
x);
warning ("%Jshadowed declaration is here", oldglobal);
}
*************** check_for_out_of_scope_variable (tree de
*** 1161,1171 ****
{
if (!DECL_ERROR_REPORTED (decl))
{
! warning ("name lookup of `%D' changed",
! DECL_NAME (decl));
! cp_warning_at (" matches this `%D' under ISO standard rules",
shadowed);
! cp_warning_at (" matches this `%D' under old rules", decl);
DECL_ERROR_REPORTED (decl) = 1;
}
return shadowed;
--- 1161,1170 ----
{
if (!DECL_ERROR_REPORTED (decl))
{
! warning ("name lookup of %qD changed", DECL_NAME (decl));
! cp_warning_at (" matches this %qD under ISO standard rules",
shadowed);
! cp_warning_at (" matches this %qD under old rules", decl);
DECL_ERROR_REPORTED (decl) = 1;
}
return shadowed;
*************** check_for_out_of_scope_variable (tree de
*** 1183,1198 ****
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
{
! error ("name lookup of `%D' changed for new ISO `for' scoping",
DECL_NAME (decl));
! cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", decl);
return error_mark_node;
}
else
{
! pedwarn ("name lookup of `%D' changed for new ISO `for' scoping",
DECL_NAME (decl));
! cp_pedwarn_at (" using obsolete binding at `%D'", decl);
}
return decl;
--- 1182,1198 ----
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
{
! error ("name lookup of %qD changed for new ISO %<for%> scoping",
DECL_NAME (decl));
! cp_error_at (" cannot use obsolete binding at %qD because "
! "it has a destructor", decl);
return error_mark_node;
}
else
{
! pedwarn ("name lookup of %qD changed for new ISO %<for%> scoping",
DECL_NAME (decl));
! cp_pedwarn_at (" using obsolete binding at %qD", decl);
}
return decl;
*************** push_overloaded_decl (tree decl, int fla
*** 2023,2030 ****
&& !(flags & PUSH_USING)
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
TYPE_ARG_TYPES (TREE_TYPE (decl))))
! error ("`%#D' conflicts with previous using declaration `%#D'",
! decl, fn);
if (duplicate_decls (decl, fn) == fn)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
--- 2023,2030 ----
&& !(flags & PUSH_USING)
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
TYPE_ARG_TYPES (TREE_TYPE (decl))))
! error ("%q#D conflicts with previous using declaration %q#D",
! decl, fn);
if (duplicate_decls (decl, fn) == fn)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
*************** push_overloaded_decl (tree decl, int fla
*** 2035,2042 ****
old = NULL_TREE;
else
{
! cp_error_at ("previous non-function declaration `%#D'", old);
! error ("conflicts with function declaration `%#D'", decl);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
}
--- 2035,2042 ----
old = NULL_TREE;
else
{
! cp_error_at ("previous non-function declaration %q#D", old);
! error ("conflicts with function declaration %q#D", decl);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
}
*************** validate_nonmember_using_decl (tree decl
*** 2114,2120 ****
member-declaration. */
if (TYPE_P (scope))
{
! error ("`%T' is not a namespace", scope);
return NULL_TREE;
}
else if (scope == error_mark_node)
--- 2114,2120 ----
member-declaration. */
if (TYPE_P (scope))
{
! error ("%qT is not a namespace", scope);
return NULL_TREE;
}
else if (scope == error_mark_node)
*************** validate_nonmember_using_decl (tree decl
*** 2124,2136 ****
{
/* 7.3.3/5
A using-declaration shall not name a template-id. */
! error ("a using-declaration cannot specify a template-id. Try `using %D'", name);
return NULL_TREE;
}
if (TREE_CODE (decl) == NAMESPACE_DECL)
{
! error ("namespace `%D' not allowed in using-declaration", decl);
return NULL_TREE;
}
--- 2124,2137 ----
{
/* 7.3.3/5
A using-declaration shall not name a template-id. */
! error ("a using-declaration cannot specify a template-id. "
! "Try %<using %D%>", name);
return NULL_TREE;
}
if (TREE_CODE (decl) == NAMESPACE_DECL)
{
! error ("namespace %qD not allowed in using-declaration", decl);
return NULL_TREE;
}
*************** validate_nonmember_using_decl (tree decl
*** 2138,2144 ****
{
/* It's a nested name with template parameter dependent scope.
This can only be using-declaration for class member. */
! error ("`%T' is not a namespace", TREE_OPERAND (decl, 0));
return NULL_TREE;
}
--- 2139,2145 ----
{
/* It's a nested name with template parameter dependent scope.
This can only be using-declaration for class member. */
! error ("%qT is not a namespace", TREE_OPERAND (decl, 0));
return NULL_TREE;
}
*************** do_nonmember_using_decl (tree scope, tre
*** 2166,2172 ****
if (!decls.value && !decls.type)
{
! error ("`%D' not declared", name);
return;
}
--- 2167,2173 ----
if (!decls.value && !decls.type)
{
! error ("%qD not declared", name);
return;
}
*************** do_nonmember_using_decl (tree scope, tre
*** 2178,2184 ****
if (oldval && !is_overloaded_fn (oldval))
{
if (!DECL_IMPLICIT_TYPEDEF_P (oldval))
! error ("`%D' is already declared in this scope", name);
oldval = NULL_TREE;
}
--- 2179,2185 ----
if (oldval && !is_overloaded_fn (oldval))
{
if (!DECL_IMPLICIT_TYPEDEF_P (oldval))
! error ("%qD is already declared in this scope", name);
oldval = NULL_TREE;
}
*************** do_nonmember_using_decl (tree scope, tre
*** 2220,2226 ****
{
/* If the OLD_FN was really declared, the
declarations don't match. */
! error ("`%D' is already declared in this scope", name);
break;
}
--- 2221,2227 ----
{
/* If the OLD_FN was really declared, the
declarations don't match. */
! error ("%qD is already declared in this scope", name);
break;
}
*************** do_nonmember_using_decl (tree scope, tre
*** 2257,2270 ****
{
*newval = decls.value;
if (oldval && !decls_match (*newval, oldval))
! error ("`%D' is already declared in this scope", name);
}
*newtype = decls.type;
if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
{
! error ("using declaration `%D' introduced ambiguous type `%T'",
! name, oldtype);
return;
}
}
--- 2258,2271 ----
{
*newval = decls.value;
if (oldval && !decls_match (*newval, oldval))
! error ("%qD is already declared in this scope", name);
}
*newtype = decls.type;
if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
{
! error ("using declaration %qD introduced ambiguous type %qT",
! name, oldtype);
return;
}
}
*************** lookup_tag (enum tree_code form, tree na
*** 2431,2437 ****
&& (form == ENUMERAL_TYPE
|| TREE_CODE (old) == ENUMERAL_TYPE))
{
! error ("`%#D' redeclared as %C", old, form);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old);
--- 2432,2438 ----
&& (form == ENUMERAL_TYPE
|| TREE_CODE (old) == ENUMERAL_TYPE))
{
! error ("%q#D redeclared as %C", old, form);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old);
*************** lookup_tag (enum tree_code form, tree na
*** 2450,2456 ****
&& (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE))
{
/* Definition isn't the kind we were looking for. */
! error ("`%#D' redeclared as %C", entry->type, form);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->type);
--- 2451,2457 ----
&& (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE))
{
/* Definition isn't the kind we were looking for. */
! error ("%q#D redeclared as %C", entry->type, form);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->type);
*************** push_class_level_binding (tree name, tre
*** 2818,2824 ****
tree scope = context_for_name_lookup (x);
if (TYPE_P (scope) && same_type_p (scope, current_class_type))
{
! error ("`%D' has the same name as the class in which it is "
"declared",
x);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
--- 2819,2825 ----
tree scope = context_for_name_lookup (x);
if (TYPE_P (scope) && same_type_p (scope, current_class_type))
{
! error ("%qD has the same name as the class in which it is "
"declared",
x);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
*************** set_decl_namespace (tree decl, tree scop
*** 3039,3046 ****
else
return;
complain:
! error ("`%D' should have been declared inside `%D'",
! decl, scope);
}
/* Return the namespace where the current declaration is declared. */
--- 3040,3046 ----
else
return;
complain:
! error ("%qD should have been declared inside %qD", decl, scope);
}
/* Return the namespace where the current declaration is declared. */
*************** push_namespace (tree name)
*** 3102,3109 ****
need_new = 0;
if (DECL_NAMESPACE_ALIAS (d))
{
! error ("namespace alias `%D' not allowed here, assuming `%D'",
! d, DECL_NAMESPACE_ALIAS (d));
d = DECL_NAMESPACE_ALIAS (d);
}
}
--- 3102,3109 ----
need_new = 0;
if (DECL_NAMESPACE_ALIAS (d))
{
! error ("namespace alias %qD not allowed here, assuming %qD",
! d, DECL_NAMESPACE_ALIAS (d));
d = DECL_NAMESPACE_ALIAS (d);
}
}
*************** do_namespace_alias (tree alias, tree nam
*** 3217,3223 ****
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
/* The parser did not find it, so it's not there. */
! error ("unknown namespace `%D'", namespace);
return;
}
--- 3217,3223 ----
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
/* The parser did not find it, so it's not there. */
! error ("unknown namespace %qD", namespace);
return;
}
*************** do_using_directive (tree namespace)
*** 3377,3389 ****
{
/* Lookup in lexer did not find a namespace. */
if (!processing_template_decl)
! error ("namespace `%T' undeclared", namespace);
return;
}
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
if (!processing_template_decl)
! error ("`%T' is not a namespace", namespace);
return;
}
namespace = ORIGINAL_NAMESPACE (namespace);
--- 3377,3389 ----
{
/* Lookup in lexer did not find a namespace. */
if (!processing_template_decl)
! error ("namespace %qT undeclared", namespace);
return;
}
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
if (!processing_template_decl)
! error ("%qT is not a namespace", namespace);
return;
}
namespace = ORIGINAL_NAMESPACE (namespace);
*************** parse_using_directive (tree namespace, t
*** 3428,3434 ****
DECL_NAMESPACE_ASSOCIATIONS (namespace));
}
else
! warning ("`%D' attribute directive ignored", name);
}
}
--- 3428,3434 ----
DECL_NAMESPACE_ASSOCIATIONS (namespace));
}
else
! warning ("%qD attribute directive ignored", name);
}
}
*************** ambiguous_decl (tree name, struct scope_
*** 3562,3572 ****
repeat ourselves. */
if (old->value != error_mark_node)
{
! error ("use of `%D' is ambiguous", name);
! cp_error_at (" first declared as `%#D' here",
! old->value);
}
! cp_error_at (" also declared as `%#D' here", val);
}
old->value = error_mark_node;
}
--- 3562,3571 ----
repeat ourselves. */
if (old->value != error_mark_node)
{
! error ("use of %qD is ambiguous", name);
! cp_error_at (" first declared as %q#D here", old->value);
}
! cp_error_at (" also declared as %q#D here", val);
}
old->value = error_mark_node;
}
*************** ambiguous_decl (tree name, struct scope_
*** 3581,3587 ****
{
if (flags & LOOKUP_COMPLAIN)
{
! error ("`%D' denotes an ambiguous type",name);
error ("%J first type here", TYPE_MAIN_DECL (old->type));
error ("%J other type here", TYPE_MAIN_DECL (type));
}
--- 3580,3586 ----
{
if (flags & LOOKUP_COMPLAIN)
{
! error ("%qD denotes an ambiguous type",name);
error ("%J first type here", TYPE_MAIN_DECL (old->type));
error ("%J other type here", TYPE_MAIN_DECL (type));
}
*************** lookup_namespace_name (tree namespace, t
*** 3647,3653 ****
{
/* This happens for A::B where B is a template, and there are no
template arguments. */
! error ("invalid use of `%D'", name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
--- 3646,3652 ----
{
/* This happens for A::B where B is a template, and there are no
template arguments. */
! error ("invalid use of %qD", name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
*************** lookup_namespace_name (tree namespace, t
*** 3687,3694 ****
TREE_OPERAND (template_id, 1));
else
{
! error ("`%D::%D' is not a template",
! namespace, name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
}
--- 3686,3692 ----
TREE_OPERAND (template_id, 1));
else
{
! error ("%<%D::%D%> is not a template", namespace, name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
}
*************** lookup_namespace_name (tree namespace, t
*** 3704,3710 ****
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
! error ("`%D' undeclared in namespace `%D'", name, namespace);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
--- 3702,3708 ----
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
! error ("%qD undeclared in namespace %qD", name, namespace);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
*************** add_function (struct arg_lookup *k, tree
*** 4241,4249 ****
{
fn = f1; f1 = f2; f2 = fn;
}
! cp_error_at ("`%D' is not a function,", f1);
! cp_error_at (" conflict with `%D'", f2);
! error (" in call to `%D'", k->name);
return true;
}
--- 4239,4247 ----
{
fn = f1; f1 = f2; f2 = fn;
}
! cp_error_at ("%qD is not a function,", f1);
! cp_error_at (" conflict with %qD", f2);
! error (" in call to %qD", k->name);
return true;
}
Index: parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.258
diff -p -r1.258 parser.c
*** parser.c 4 Oct 2004 06:04:38 -0000 1.258
--- parser.c 5 Oct 2004 12:40:17 -0000
*************** cp_parser_name_lookup_error (cp_parser*
*** 1872,1897 ****
if (decl == error_mark_node)
{
if (parser->scope && parser->scope != global_namespace)
! error ("`%D::%D' has not been declared",
parser->scope, name);
else if (parser->scope == global_namespace)
! error ("`::%D' has not been declared", name);
else if (parser->object_scope
&& !CLASS_TYPE_P (parser->object_scope))
! error ("request for member `%D' in non-class type `%T'",
name, parser->object_scope);
else if (parser->object_scope)
! error ("`%T::%D' has not been declared",
parser->object_scope, name);
else
error ("`%D' has not been declared", name);
}
else if (parser->scope && parser->scope != global_namespace)
! error ("`%D::%D' %s", parser->scope, name, desired);
else if (parser->scope == global_namespace)
! error ("`::%D' %s", name, desired);
else
! error ("`%D' %s", name, desired);
}
/* If we are parsing tentatively, remember that an error has occurred
--- 1872,1897 ----
if (decl == error_mark_node)
{
if (parser->scope && parser->scope != global_namespace)
! error ("%<%D::%D%> has not been declared",
parser->scope, name);
else if (parser->scope == global_namespace)
! error ("%<::%D%> has not been declared", name);
else if (parser->object_scope
&& !CLASS_TYPE_P (parser->object_scope))
! error ("request for member %qD in non-class type %qT",
name, parser->object_scope);
else if (parser->object_scope)
! error ("%<%T::%D%> has not been declared",
parser->object_scope, name);
else
error ("`%D' has not been declared", name);
}
else if (parser->scope && parser->scope != global_namespace)
! error ("%<%D::%D%> %s", parser->scope, name, desired);
else if (parser->scope == global_namespace)
! error ("%<::%D%> %s", name, desired);
else
! error ("%qD %s", name, desired);
}
/* If we are parsing tentatively, remember that an error has occurred
*************** cp_parser_check_for_invalid_template_id
*** 1962,1970 ****
if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
{
if (TYPE_P (type))
! error ("`%T' is not a template", type);
else if (TREE_CODE (type) == IDENTIFIER_NODE)
! error ("`%E' is not a template", type);
else
error ("invalid template-id");
/* Remember the location of the invalid "<". */
--- 1962,1970 ----
if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
{
if (TYPE_P (type))
! error ("%qT is not a template", type);
else if (TREE_CODE (type) == IDENTIFIER_NODE)
! error ("%qE is not a template", type);
else
error ("invalid template-id");
/* Remember the location of the invalid "<". */
*************** cp_parser_diagnose_invalid_type_name (cp
*** 2031,2042 ****
/* If the lookup found a template-name, it means that the user forgot
to specify an argument list. Emit an useful error message. */
if (TREE_CODE (decl) == TEMPLATE_DECL)
! error ("invalid use of template-name `%E' without an argument list",
decl);
else if (!parser->scope)
{
/* Issue an error message. */
! error ("`%E' does not name a type", id);
/* If we're in a template class, it's possible that the user was
referring to a type from a base class. For example:
--- 2031,2042 ----
/* If the lookup found a template-name, it means that the user forgot
to specify an argument list. Emit an useful error message. */
if (TREE_CODE (decl) == TEMPLATE_DECL)
! error ("invalid use of template-name %qE without an argument list",
decl);
else if (!parser->scope)
{
/* Issue an error message. */
! error ("%qE does not name a type", id);
/* If we're in a template class, it's possible that the user was
referring to a type from a base class. For example:
*************** cp_parser_diagnose_invalid_type_name (cp
*** 2082,2092 ****
else
{
if (TREE_CODE (parser->scope) == NAMESPACE_DECL)
! error ("`%E' in namespace `%E' does not name a type",
id, parser->scope);
else if (TYPE_P (parser->scope))
! error ("`%E' in class `%T' does not name a type",
! id, parser->scope);
else
gcc_unreachable ();
}
--- 2082,2091 ----
else
{
if (TREE_CODE (parser->scope) == NAMESPACE_DECL)
! error ("%qE in namespace %qE does not name a type",
id, parser->scope);
else if (TYPE_P (parser->scope))
! error ("q%E in class %qT does not name a type", id, parser->scope);
else
gcc_unreachable ();
}
*************** cp_parser_primary_expression (cp_parser
*** 2816,2822 ****
cp_lexer_consume_token (parser->lexer);
if (parser->local_variables_forbidden_p)
{
! error ("`this' may not be used in this context");
return error_mark_node;
}
/* Pointers cannot appear in constant-expressions. */
--- 2815,2821 ----
cp_lexer_consume_token (parser->lexer);
if (parser->local_variables_forbidden_p)
{
! error ("%<this%> may not be used in this context");
return error_mark_node;
}
/* Pointers cannot appear in constant-expressions. */
*************** cp_parser_primary_expression (cp_parser
*** 2951,2957 ****
decl = check_for_out_of_scope_variable (decl);
if (local_variable_p (decl))
{
! error ("local variable `%D' may not appear in this context",
decl);
return error_mark_node;
}
--- 2950,2956 ----
decl = check_for_out_of_scope_variable (decl);
if (local_variable_p (decl))
{
! error ("local variable %qD may not appear in this context",
decl);
return error_mark_node;
}
*************** cp_parser_unqualified_id (cp_parser* par
*** 3316,3322 ****
if (declarator_p
&& !DECL_IMPLICIT_TYPEDEF_P (type_decl)
&& !DECL_SELF_REFERENCE_P (type_decl))
! error ("typedef-name `%D' used as destructor declarator",
type_decl);
return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
--- 3315,3321 ----
if (declarator_p
&& !DECL_IMPLICIT_TYPEDEF_P (type_decl)
&& !DECL_SELF_REFERENCE_P (type_decl))
! error ("typedef-name %qD used as destructor declarator",
type_decl);
return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
*************** cp_parser_nested_name_specifier_opt (cp_
*** 3522,3529 ****
decl = cp_parser_lookup_name_simple (parser, token->value);
if (TREE_CODE (decl) == TEMPLATE_DECL)
! error ("`%D' used without template parameters",
! decl);
else
cp_parser_name_lookup_error
(parser, token->value, decl,
--- 3521,3527 ----
decl = cp_parser_lookup_name_simple (parser, token->value);
if (TREE_CODE (decl) == TEMPLATE_DECL)
! error ("%qD used without template parameters", decl);
else
cp_parser_name_lookup_error
(parser, token->value, decl,
*************** cp_parser_direct_new_declarator (cp_pars
*** 5051,5057 ****
/*complain=*/true);
if (!expression)
{
! error ("expression in new-declarator must have integral or enumeration type");
expression = error_mark_node;
}
}
--- 5049,5056 ----
/*complain=*/true);
if (!expression)
{
! error ("expression in new-declarator must have integral "
! "or enumeration type");
expression = error_mark_node;
}
}
*************** cp_parser_labeled_statement (cp_parser*
*** 5987,5993 ****
expr_hi = NULL_TREE;
if (!parser->in_switch_statement_p)
! error ("case label `%E' not within a switch statement", expr);
else
statement = finish_case_label (expr, expr_hi);
}
--- 5986,5992 ----
expr_hi = NULL_TREE;
if (!parser->in_switch_statement_p)
! error ("case label %qE not within a switch statement", expr);
else
statement = finish_case_label (expr, expr_hi);
}
*************** cp_parser_jump_statement (cp_parser* par
*** 6493,6499 ****
}
else
statement = finish_break_stmt ();
! cp_parser_require (parser, CPP_SEMICOLON, "`;'");
break;
case RID_CONTINUE:
--- 6492,6498 ----
}
else
statement = finish_break_stmt ();
! cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break;
case RID_CONTINUE:
*************** cp_parser_jump_statement (cp_parser* par
*** 6504,6510 ****
}
else
statement = finish_continue_stmt ();
! cp_parser_require (parser, CPP_SEMICOLON, "`;'");
break;
case RID_RETURN:
--- 6503,6509 ----
}
else
statement = finish_continue_stmt ();
! cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break;
case RID_RETURN:
*************** cp_parser_jump_statement (cp_parser* par
*** 6520,6526 ****
/* Build the return-statement. */
statement = finish_return_stmt (expr);
/* Look for the final `;'. */
! cp_parser_require (parser, CPP_SEMICOLON, "`;'");
}
break;
--- 6519,6525 ----
/* Build the return-statement. */
statement = finish_return_stmt (expr);
/* Look for the final `;'. */
! cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
}
break;
*************** cp_parser_jump_statement (cp_parser* par
*** 6539,6545 ****
else
finish_goto_stmt (cp_parser_identifier (parser));
/* Look for the final `;'. */
! cp_parser_require (parser, CPP_SEMICOLON, "`;'");
break;
default:
--- 6538,6544 ----
else
finish_goto_stmt (cp_parser_identifier (parser));
/* Look for the final `;'. */
! cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break;
default:
*************** cp_parser_simple_declaration (cp_parser*
*** 6997,7003 ****
if (decl != error_mark_node
|| (cp_parser_parsing_tentatively (parser)
&& !cp_parser_committed_to_tentative_parse (parser)))
! cp_parser_error (parser, "expected `,' or `;'");
/* Skip tokens until we reach the end of the statement. */
cp_parser_skip_to_end_of_statement (parser);
/* If the next token is now a `;', consume it. */
--- 6996,7002 ----
if (decl != error_mark_node
|| (cp_parser_parsing_tentatively (parser)
&& !cp_parser_committed_to_tentative_parse (parser)))
! cp_parser_error (parser, "expected %<,%> or %<;%>");
/* Skip tokens until we reach the end of the statement. */
cp_parser_skip_to_end_of_statement (parser);
/* If the next token is now a `;', consume it. */
*************** cp_parser_decl_specifier_seq (cp_parser*
*** 7105,7111 ****
friend */
case RID_FRIEND:
if (decl_specs->specs[(int) ds_friend]++)
! error ("duplicate `friend'");
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
break;
--- 7104,7110 ----
friend */
case RID_FRIEND:
if (decl_specs->specs[(int) ds_friend]++)
! error ("duplicate %<friend%>");
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
break;
*************** cp_parser_mem_initializer_id (cp_parser*
*** 7679,7685 ****
/* `typename' is not allowed in this context ([temp.res]). */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{
! error ("keyword `typename' not allowed in this context (a qualified "
"member initializer is implicitly a type)");
cp_lexer_consume_token (parser->lexer);
}
--- 7678,7684 ----
/* `typename' is not allowed in this context ([temp.res]). */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{
! error ("keyword %<typename%> not allowed in this context (a qualified "
"member initializer is implicitly a type)");
cp_lexer_consume_token (parser->lexer);
}
*************** cp_parser_template_declaration (cp_parse
*** 8041,8047 ****
/* Consume the `export' token. */
cp_lexer_consume_token (parser->lexer);
/* Warn that we do not support `export'. */
! warning ("keyword `export' not implemented, and will be ignored");
}
cp_parser_template_declaration_after_export (parser, member_p);
--- 8040,8046 ----
/* Consume the `export' token. */
cp_lexer_consume_token (parser->lexer);
/* Warn that we do not support `export'. */
! warning ("keyword %<export%> not implemented, and will be ignored");
}
cp_parser_template_declaration_after_export (parser, member_p);
*************** cp_parser_type_parameter (cp_parser* par
*** 8294,8300 ****
default:
/* Anything else is an error. */
cp_parser_error (parser,
! "expected `class', `typename', or `template'");
parameter = error_mark_node;
}
--- 8293,8299 ----
default:
/* Anything else is an error. */
cp_parser_error (parser,
! "expected %<class%>, %<typename%>, or %<template%>");
parameter = error_mark_node;
}
*************** cp_parser_template_id (cp_parser *parser
*** 8408,8428 ****
and return simply an error. Maybe this is not a template-id
after all. */
next_token_2->type = CPP_COLON;
! cp_parser_error (parser, "expected `<'");
pop_deferring_access_checks ();
return error_mark_node;
}
/* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */
! pedwarn ("`<::' cannot begin a template-argument list");
! inform ("`<:' is an alternate spelling for `['. Insert whitespace "
! "between `<' and `::'");
if (!flag_permissive)
{
static bool hint;
if (!hint)
{
! inform ("(if you use `-fpermissive' G++ will accept your code)");
hint = true;
}
}
--- 8407,8427 ----
and return simply an error. Maybe this is not a template-id
after all. */
next_token_2->type = CPP_COLON;
! cp_parser_error (parser, "expected %<<%>");
pop_deferring_access_checks ();
return error_mark_node;
}
/* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */
! pedwarn ("%<<::%> cannot begin a template-argument list");
! inform ("%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
! "between %<<%> and %<::%>");
if (!flag_permissive)
{
static bool hint;
if (!hint)
{
! inform ("(if you use -fpermissive G++ will accept your code)");
hint = true;
}
}
*************** cp_parser_template_name (cp_parser* pars
*** 8597,8604 ****
ptrdiff_t start;
cp_token* token;
/* Explain what went wrong. */
! error ("non-template `%D' used as template", identifier);
! inform ("use `%T::template %D' to indicate that it is a template",
parser->scope, identifier);
/* If parsing tentatively, find the location of the "<"
token. */
--- 8596,8603 ----
ptrdiff_t start;
cp_token* token;
/* Explain what went wrong. */
! error ("non-template %qD used as template", identifier);
! inform ("use %<%T::template %D%> to indicate that it is a template",
parser->scope, identifier);
/* If parsing tentatively, find the location of the "<"
token. */
*************** cp_parser_elaborated_type_specifier (cp_
*** 9625,9631 ****
tag_type = typename_type;
/* The `typename' keyword is only allowed in templates. */
if (!processing_template_decl)
! pedwarn ("using `typename' outside of template");
}
/* Otherwise it must be a class-key. */
else
--- 9624,9630 ----
tag_type = typename_type;
/* The `typename' keyword is only allowed in templates. */
if (!processing_template_decl)
! pedwarn ("using %<typename%> outside of template");
}
/* Otherwise it must be a class-key. */
else
*************** cp_parser_direct_declarator (cp_parser*
*** 11068,11074 ****
/*only_current_p=*/false);
/* If that failed, the declarator is invalid. */
if (type == error_mark_node)
! error ("`%T::%D' is not a type",
TYPE_CONTEXT (scope),
TYPE_IDENTIFIER (scope));
/* Build a new DECLARATOR. */
--- 11067,11073 ----
/*only_current_p=*/false);
/* If that failed, the declarator is invalid. */
if (type == error_mark_node)
! error ("%<%T::%D%> is not a type",
TYPE_CONTEXT (scope),
TYPE_IDENTIFIER (scope));
/* Build a new DECLARATOR. */
*************** cp_parser_direct_declarator (cp_parser*
*** 11114,11121 ****
&& CLASSTYPE_USE_TEMPLATE (TREE_TYPE (unqualified_name)))
{
error ("invalid use of constructor as a template");
! inform ("use `%T::%D' instead of `%T::%T' to name the "
! "constructor in a qualified name", class_type,
DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
class_type, class_type);
}
--- 11113,11121 ----
&& CLASSTYPE_USE_TEMPLATE (TREE_TYPE (unqualified_name)))
{
error ("invalid use of constructor as a template");
! inform ("use %<%T::%D%> instead of %<%T::%T%> to name "
! "the constructor in a qualified name",
! class_type,
DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
class_type, class_type);
}
*************** cp_parser_parameter_declaration_list (cp
*** 11626,11632 ****
}
else
{
! cp_parser_error (parser, "expected `,' or `...'");
if (!cp_parser_parsing_tentatively (parser)
|| cp_parser_committed_to_tentative_parse (parser))
cp_parser_skip_to_closing_parenthesis (parser,
--- 11626,11632 ----
}
else
{
! cp_parser_error (parser, "expected %<,%> or %<...%>");
if (!cp_parser_parsing_tentatively (parser)
|| cp_parser_committed_to_tentative_parse (parser))
cp_parser_skip_to_closing_parenthesis (parser,
*************** cp_parser_class_head (cp_parser* parser,
*** 12595,12601 ****
xref_tag, since that has irreversible side-effects. */
if (!cp_parser_next_token_starts_class_definition_p (parser))
{
! cp_parser_error (parser, "expected `{' or `:'");
return error_mark_node;
}
--- 12595,12601 ----
xref_tag, since that has irreversible side-effects. */
if (!cp_parser_next_token_starts_class_definition_p (parser))
{
! cp_parser_error (parser, "expected %<{%> or %<:%>");
return error_mark_node;
}
*************** cp_parser_class_head (cp_parser* parser,
*** 12620,12627 ****
class was originally declared, the program is invalid. */
if (scope && !is_ancestor (scope, nested_name_specifier))
{
! error ("declaration of `%D' in `%D' which does not "
! "enclose `%D'", type, scope, nested_name_specifier);
type = NULL_TREE;
goto done;
}
--- 12620,12627 ----
class was originally declared, the program is invalid. */
if (scope && !is_ancestor (scope, nested_name_specifier))
{
! error ("declaration of %qD in %qD which does not enclose %qD",
! type, scope, nested_name_specifier);
type = NULL_TREE;
goto done;
}
*************** cp_parser_class_head (cp_parser* parser,
*** 12644,12650 ****
&& parser->num_template_parameter_lists == 0
&& template_id_p)
{
! error ("an explicit specialization must be preceded by 'template <>'");
invalid_explicit_specialization_p = true;
/* Take the same action that would have been taken by
cp_parser_explicit_specialization. */
--- 12644,12650 ----
&& parser->num_template_parameter_lists == 0
&& template_id_p)
{
! error ("an explicit specialization must be preceded by %<template <>%>");
invalid_explicit_specialization_p = true;
/* Take the same action that would have been taken by
cp_parser_explicit_specialization. */
*************** cp_parser_member_declaration (cp_parser*
*** 13179,13185 ****
else if (cp_lexer_next_token_is_not (parser->lexer,
CPP_SEMICOLON))
{
! cp_parser_error (parser, "expected `;'");
/* Skip tokens until we find a `;'. */
cp_parser_skip_to_end_of_statement (parser);
--- 13179,13185 ----
else if (cp_lexer_next_token_is_not (parser->lexer,
CPP_SEMICOLON))
{
! cp_parser_error (parser, "expected %<;%>");
/* Skip tokens until we find a `;'. */
cp_parser_skip_to_end_of_statement (parser);
*************** cp_parser_base_specifier (cp_parser* par
*** 13364,13370 ****
if (virtual_p && !duplicate_virtual_error_issued_p)
{
cp_parser_error (parser,
! "`virtual' specified more than once in base-specified");
duplicate_virtual_error_issued_p = true;
}
--- 13364,13370 ----
if (virtual_p && !duplicate_virtual_error_issued_p)
{
cp_parser_error (parser,
! "%<virtual%> specified more than once in base-specified");
duplicate_virtual_error_issued_p = true;
}
*************** cp_parser_base_specifier (cp_parser* par
*** 13406,13414 ****
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{
if (!processing_template_decl)
! error ("keyword `typename' not allowed outside of templates");
else
! error ("keyword `typename' not allowed in this context "
"(the base class is implicitly a type)");
cp_lexer_consume_token (parser->lexer);
}
--- 13406,13414 ----
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{
if (!processing_template_decl)
! error ("keyword %<typename%> not allowed outside of templates");
else
! error ("keyword %<typename%> not allowed in this context "
"(the base class is implicitly a type)");
cp_lexer_consume_token (parser->lexer);
}
*************** cp_parser_lookup_name (cp_parser *parser
*** 14243,14249 ****
cp_parser_error, so we incorporate its actions directly. */
if (!cp_parser_simulate_error (parser))
{
! error ("reference to `%D' is ambiguous", name);
print_candidates (decl);
}
return error_mark_node;
--- 14243,14249 ----
cp_parser_error, so we incorporate its actions directly. */
if (!cp_parser_simulate_error (parser))
{
! error ("reference to %qD is ambiguous", name);
print_candidates (decl);
}
return error_mark_node;
*************** cp_parser_late_parsing_default_args (cp_
*** 15203,15209 ****
there was extra junk after the end of the default
argument. */
if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF))
! cp_parser_error (parser, "expected `,'");
/* Revert to the main lexer. */
cp_parser_pop_lexer (parser);
--- 15203,15209 ----
there was extra junk after the end of the default
argument. */
if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF))
! cp_parser_error (parser, "expected %<,%>");
/* Revert to the main lexer. */
cp_parser_pop_lexer (parser);
*************** static void
*** 15572,15578 ****
cp_parser_check_class_key (enum tag_types class_key, tree type)
{
if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
! pedwarn ("`%s' tag used in naming `%#T'",
class_key == union_type ? "union"
: class_key == record_type ? "struct" : "class",
type);
--- 15572,15578 ----
cp_parser_check_class_key (enum tag_types class_key, tree type)
{
if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
! pedwarn ("%qs tag used in naming %q#T",
class_key == union_type ? "union"
: class_key == record_type ? "struct" : "class",
type);
*************** cp_parser_check_class_key (enum tag_type
*** 15583,15589 ****
This applies to nested classes and nested class templates.
[class.mem/1]. */
! static void cp_parser_check_access_in_redeclaration (tree decl)
{
if (!CLASS_TYPE_P (TREE_TYPE (decl)))
return;
--- 15583,15590 ----
This applies to nested classes and nested class templates.
[class.mem/1]. */
! static void
! cp_parser_check_access_in_redeclaration (tree decl)
{
if (!CLASS_TYPE_P (TREE_TYPE (decl)))
return;
*************** static void cp_parser_check_access_in_re
*** 15592,15598 ****
!= (current_access_specifier == access_private_node))
|| (TREE_PROTECTED (decl)
!= (current_access_specifier == access_protected_node)))
! error ("%D redeclared with different access", decl);
}
/* Look for the `template' keyword, as a syntactic disambiguator.
--- 15593,15599 ----
!= (current_access_specifier == access_private_node))
|| (TREE_PROTECTED (decl)
!= (current_access_specifier == access_protected_node)))
! error ("%qD redeclared with different access", decl);
}
/* Look for the `template' keyword, as a syntactic disambiguator.
*************** cp_parser_optional_template_keyword (cp_
*** 15609,15615 ****
template and what is not. */
if (!processing_template_decl)
{
! error ("`template' (as a disambiguator) is only allowed "
"within templates");
/* If this part of the token stream is rescanned, the same
error message would be generated. So, we purge the token
--- 15610,15616 ----
template and what is not. */
if (!processing_template_decl)
{
! error ("%<template%> (as a disambiguator) is only allowed "
"within templates");
/* If this part of the token stream is rescanned, the same
error message would be generated. So, we purge the token