This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ diagnostics: Use quoting flag q (7/n)
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: 10 Oct 2004 17:27:43 -0500
- Subject: C++ diagnostics: Use quoting flag q (7/n)
- Organization: Integrable Solutions
This is assumed to finish the conversion of the C++ front-end to use
the newly recommended quotation marks. Any remaining old-style
quotations is now officially considered a bug.
Bootstrapped and regtested on an i686-pc-linux-gnu
cp/
2004-10-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 7/n
* typeck.c (composite_pointer_type_r, composite_pointer_type,
cxx_sizeof_or_alignof_type, cxx_sizeof_or_alignof_expr,
string_conv_p, build_class_member_access_expr,
build_class_member_access_expr, lookup_destructor,
finish_class_member_access_expr, build_indirect_ref,
get_member_function_from_ptrfunc, build_function_call,
convert_arguments, build_binary_op, pointer_diff, build_unary_op,
check_for_casting_away_constness, build_static_cast,
build_reinterpret_cast, build_const_cast, build_c_cast,
build_modify_expr, get_delta_difference, build_ptrmemfunc,
dubious_conversion_warnings, convert_for_assignment,
convert_for_initialization,
maybe_warn_about_returning_address_of_local, check_return_expr):
Use quoting marks.
* typeck2.c (error_not_base_type, readonly_error,
abstract_virtuals_error, cxx_incomplete_type_diagnostic,
store_init_value, digest_init, build_x_arrow,
build_m_component_ref, require_complete_eh_spec_types): Likewise.
* tree.c (cp_build_qualified_type_real,
handle_java_interface_attribute, handle_init_priority_attribute):
Likewise.
* semantics.c (finish_asm_stmt, finish_non_static_data_member,
finish_pseudo_destructor_expr,
check_template_template_default_arg, begin_class_definition,
finish_base_specifier, qualified_name_lookup_error,
finish_id_expression, finish_typeof): Likewise.
* search.c (lookup_base, check_final_overrider,
look_for_overrides_r): Likewise.
* rtti.c (get_tinfo_decl, build_dynamic_cast_1): Likewise.
testsuite/
2004-10-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
* g++.dg/overload/pmf1.C: Adjust quoting marks.
* g++.dg/warn/incomplete1.C: Likewise.
* g++.dg/template/qualttp20.C: Likewise.
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/rtti.c,v
retrieving revision 1.200
diff -p -r1.200 rtti.c
*** cp/rtti.c 22 Sep 2004 18:12:10 -0000 1.200
--- cp/rtti.c 10 Oct 2004 21:22:33 -0000
*************** get_tinfo_decl (tree type)
*** 318,324 ****
if (COMPLETE_TYPE_P (type)
&& TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{
! error ("cannot create type information for type `%T' because its size is variable",
type);
return error_mark_node;
}
--- 318,325 ----
if (COMPLETE_TYPE_P (type)
&& TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{
! error ("cannot create type information for type %qT because "
! "its size is variable",
type);
return error_mark_node;
}
*************** build_dynamic_cast_1 (tree type, tree ex
*** 570,577 ****
&& TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE)
{
tree expr = throw_bad_cast ();
! warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
! old_expr, type);
/* Bash it to the expected type. */
TREE_TYPE (expr) = type;
return expr;
--- 571,578 ----
&& TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE)
{
tree expr = throw_bad_cast ();
! warning ("dynamic_cast of %q#D to %q#T can never succeed",
! old_expr, type);
/* Bash it to the expected type. */
TREE_TYPE (expr) = type;
return expr;
*************** build_dynamic_cast_1 (tree type, tree ex
*** 584,591 ****
if (TREE_CODE (op) == VAR_DECL
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
{
! warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
! op, type);
retval = build_int_cst (type, 0);
return retval;
}
--- 585,592 ----
if (TREE_CODE (op) == VAR_DECL
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
{
! warning ("dynamic_cast of %q#D to %q#T can never succeed",
! op, type);
retval = build_int_cst (type, 0);
return retval;
}
*************** build_dynamic_cast_1 (tree type, tree ex
*** 663,670 ****
errstr = "source type is not polymorphic";
fail:
! error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T' (%s)",
! expr, exprtype, type, errstr);
return error_mark_node;
}
--- 664,671 ----
errstr = "source type is not polymorphic";
fail:
! error ("cannot dynamic_cast %qE (of type %q#T) to type %q#T (%s)",
! expr, exprtype, type, errstr);
return error_mark_node;
}
Index: cp/search.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/search.c,v
retrieving revision 1.327
diff -p -r1.327 search.c
*** cp/search.c 8 Oct 2004 13:04:09 -0000 1.327
--- cp/search.c 10 Oct 2004 21:22:34 -0000
*************** lookup_base (tree t, tree base, base_acc
*** 234,240 ****
binfo = NULL_TREE;
if (!(access & ba_quiet))
{
! error ("`%T' is an ambiguous base of `%T'", base, t);
binfo = error_mark_node;
}
break;
--- 234,240 ----
binfo = NULL_TREE;
if (!(access & ba_quiet))
{
! error ("%qT is an ambiguous base of %qT", base, t);
binfo = error_mark_node;
}
break;
*************** lookup_base (tree t, tree base, base_acc
*** 252,258 ****
{
if (!(access & ba_quiet))
{
! error ("`%T' is an inaccessible base of `%T'", base, t);
binfo = error_mark_node;
}
else
--- 252,258 ----
{
if (!(access & ba_quiet))
{
! error ("%qT is an inaccessible base of %qT", base, t);
binfo = error_mark_node;
}
else
*************** check_final_overrider (tree overrider, t
*** 1740,1753 ****
{
if (fail == 1)
{
! cp_error_at ("invalid covariant return type for `%#D'", overrider);
! cp_error_at (" overriding `%#D'", basefn);
}
else
{
! cp_error_at ("conflicting return type specified for `%#D'",
overrider);
! cp_error_at (" overriding `%#D'", basefn);
}
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
--- 1740,1753 ----
{
if (fail == 1)
{
! cp_error_at ("invalid covariant return type for %q#D", overrider);
! cp_error_at (" overriding %q#D", basefn);
}
else
{
! cp_error_at ("conflicting return type specified for %q#D",
overrider);
! cp_error_at (" overriding %q#D", basefn);
}
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
*************** check_final_overrider (tree overrider, t
*** 1756,1763 ****
/* Check throw specifier is at least as strict. */
if (!comp_except_specs (base_throw, over_throw, 0))
{
! cp_error_at ("looser throw specifier for `%#F'", overrider);
! cp_error_at (" overriding `%#F'", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
--- 1756,1763 ----
/* Check throw specifier is at least as strict. */
if (!comp_except_specs (base_throw, over_throw, 0))
{
! cp_error_at ("looser throw specifier for %q#F", overrider);
! cp_error_at (" overriding %q#F", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
*************** look_for_overrides_r (tree type, tree fn
*** 1850,1857 ****
{
/* A static member function cannot match an inherited
virtual member function. */
! cp_error_at ("`%#D' cannot be declared", fndecl);
! cp_error_at (" since `%#D' declared in base class", fn);
}
else
{
--- 1850,1857 ----
{
/* A static member function cannot match an inherited
virtual member function. */
! cp_error_at ("%q#D cannot be declared", fndecl);
! cp_error_at (" since %q#D declared in base class", fn);
}
else
{
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.442
diff -p -r1.442 semantics.c
*** cp/semantics.c 6 Oct 2004 22:09:22 -0000 1.442
--- cp/semantics.c 10 Oct 2004 21:22:36 -0000
*************** finish_asm_stmt (int volatile_p, tree st
*** 1130,1137 ****
resolve the overloading. */
if (TREE_TYPE (converted_operand) == unknown_type_node)
{
! error ("type of asm operand `%E' could not be determined",
! TREE_VALUE (t));
converted_operand = error_mark_node;
}
TREE_VALUE (t) = converted_operand;
--- 1130,1137 ----
resolve the overloading. */
if (TREE_TYPE (converted_operand) == unknown_type_node)
{
! error ("type of asm operand %qE could not be determined",
! TREE_VALUE (t));
converted_operand = error_mark_node;
}
TREE_VALUE (t) = converted_operand;
*************** finish_non_static_data_member (tree decl
*** 1263,1272 ****
{
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
! cp_error_at ("invalid use of member `%D' in static member function",
decl);
else
! cp_error_at ("invalid use of non-static data member `%D'", decl);
error ("from this location");
return error_mark_node;
--- 1263,1272 ----
{
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
! cp_error_at ("invalid use of member %qD in static member function",
decl);
else
! cp_error_at ("invalid use of non-static data member %qD", decl);
error ("from this location");
return error_mark_node;
*************** finish_non_static_data_member (tree decl
*** 1305,1311 ****
if (!access_type)
{
! cp_error_at ("object missing in reference to `%D'", decl);
error ("from this location");
return error_mark_node;
}
--- 1305,1311 ----
if (!access_type)
{
! cp_error_at ("object missing in reference to %qD", decl);
error ("from this location");
return error_mark_node;
}
*************** finish_pseudo_destructor_expr (tree obje
*** 1886,1892 ****
if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (object),
destructor))
{
! error ("`%E' is not of type `%T'", object, destructor);
return error_mark_node;
}
}
--- 1886,1892 ----
if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (object),
destructor))
{
! error ("%qE is not of type %qT", object, destructor);
return error_mark_node;
}
}
*************** check_template_template_default_arg (tre
*** 2024,2033 ****
that the user is using a template instantiation. */
if (CLASSTYPE_TEMPLATE_INFO (t)
&& CLASSTYPE_TEMPLATE_INSTANTIATION (t))
! error ("invalid use of type `%T' as a default value for a "
"template template-parameter", t);
else
! error ("invalid use of `%D' as a default value for a template "
"template-parameter", argument);
}
else
--- 2024,2033 ----
that the user is using a template instantiation. */
if (CLASSTYPE_TEMPLATE_INFO (t)
&& CLASSTYPE_TEMPLATE_INSTANTIATION (t))
! error ("invalid use of type %qT as a default value for a "
"template template-parameter", t);
else
! error ("invalid use of %qD as a default value for a template "
"template-parameter", argument);
}
else
*************** begin_class_definition (tree t)
*** 2048,2054 ****
if (processing_template_parmlist)
{
! error ("definition of `%#T' inside template parameter list", t);
return error_mark_node;
}
/* A non-implicit typename comes from code like:
--- 2048,2054 ----
if (processing_template_parmlist)
{
! error ("definition of %q#T inside template parameter list", t);
return error_mark_node;
}
/* A non-implicit typename comes from code like:
*************** begin_class_definition (tree t)
*** 2059,2065 ****
This is erroneous. */
else if (TREE_CODE (t) == TYPENAME_TYPE)
{
! error ("invalid definition of qualified type `%T'", t);
t = error_mark_node;
}
--- 2059,2065 ----
This is erroneous. */
else if (TREE_CODE (t) == TYPENAME_TYPE)
{
! error ("invalid definition of qualified type %qT", t);
t = error_mark_node;
}
*************** begin_class_definition (tree t)
*** 2073,2080 ****
that's an error. */
if (COMPLETE_TYPE_P (t))
{
! error ("redefinition of `%#T'", t);
! cp_error_at ("previous definition of `%#T'", t);
return error_mark_node;
}
--- 2073,2080 ----
that's an error. */
if (COMPLETE_TYPE_P (t))
{
! error ("redefinition of %q#T", t);
! cp_error_at ("previous definition of %q#T", t);
return error_mark_node;
}
*************** finish_base_specifier (tree base, tree a
*** 2259,2265 ****
{
if (cp_type_quals (base) != 0)
{
! error ("base class `%T' has cv qualifiers", base);
base = TYPE_MAIN_VARIANT (base);
}
result = build_tree_list (access, base);
--- 2259,2265 ----
{
if (cp_type_quals (base) != 0)
{
! error ("base class %qT has cv qualifiers", base);
base = TYPE_MAIN_VARIANT (base);
}
result = build_tree_list (access, base);
*************** qualified_name_lookup_error (tree scope,
*** 2304,2322 ****
if (TYPE_P (scope))
{
if (!COMPLETE_TYPE_P (scope))
! error ("incomplete type `%T' used in nested name specifier", scope);
else if (TREE_CODE (decl) == TREE_LIST)
{
! error ("reference to `%T::%D' is ambiguous", scope, name);
print_candidates (decl);
}
else
! error ("`%D' is not a member of `%T'", name, scope);
}
else if (scope != global_namespace)
! error ("`%D' is not a member of `%D'", name, scope);
else
! error ("`::%D' has not been declared", name);
}
/* ID_EXPRESSION is a representation of parsed, but unprocessed,
--- 2304,2322 ----
if (TYPE_P (scope))
{
if (!COMPLETE_TYPE_P (scope))
! error ("incomplete type %qT used in nested name specifier", scope);
else if (TREE_CODE (decl) == TREE_LIST)
{
! error ("reference to %<%T::%D%> is ambiguous", scope, name);
print_candidates (decl);
}
else
! error ("%qD is not a member of %qT", name, scope);
}
else if (scope != global_namespace)
! error ("%qD is not a member of %qD", name, scope);
else
! error ("%<::%D%> has not been declared", name);
}
/* ID_EXPRESSION is a representation of parsed, but unprocessed,
*************** finish_id_expression (tree id_expression
*** 2439,2445 ****
&& !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl)))
{
if (!allow_non_integral_constant_expression_p)
! error ("template parameter `%D' of type `%T' is not allowed in "
"an integral constant expression because it is not of "
"integral or enumeration type", decl, TREE_TYPE (decl));
*non_integral_constant_expression_p = true;
--- 2439,2445 ----
&& !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl)))
{
if (!allow_non_integral_constant_expression_p)
! error ("template parameter %qD of type %qT is not allowed in "
"an integral constant expression because it is not of "
"integral or enumeration type", decl, TREE_TYPE (decl));
*non_integral_constant_expression_p = true;
*************** finish_id_expression (tree id_expression
*** 2583,2589 ****
{
if (!allow_non_integral_constant_expression_p)
{
! error ("`%D' cannot appear in a constant-expression", decl);
return error_mark_node;
}
*non_integral_constant_expression_p = true;
--- 2583,2589 ----
{
if (!allow_non_integral_constant_expression_p)
{
! error ("%qD cannot appear in a constant-expression", decl);
return error_mark_node;
}
*non_integral_constant_expression_p = true;
*************** finish_id_expression (tree id_expression
*** 2591,2608 ****
if (TREE_CODE (decl) == NAMESPACE_DECL)
{
! error ("use of namespace `%D' as expression", decl);
return error_mark_node;
}
else if (DECL_CLASS_TEMPLATE_P (decl))
{
! error ("use of class template `%T' as expression", decl);
return error_mark_node;
}
else if (TREE_CODE (decl) == TREE_LIST)
{
/* Ambiguous reference to base members. */
! error ("request for member `%D' is ambiguous in "
"multiple inheritance lattice", id_expression);
print_candidates (decl);
return error_mark_node;
--- 2591,2608 ----
if (TREE_CODE (decl) == NAMESPACE_DECL)
{
! error ("use of namespace %qD as expression", decl);
return error_mark_node;
}
else if (DECL_CLASS_TEMPLATE_P (decl))
{
! error ("use of class template %qT as expression", decl);
return error_mark_node;
}
else if (TREE_CODE (decl) == TREE_LIST)
{
/* Ambiguous reference to base members. */
! error ("request for member %qD is ambiguous in "
"multiple inheritance lattice", id_expression);
print_candidates (decl);
return error_mark_node;
*************** finish_id_expression (tree id_expression
*** 2665,2672 ****
{
error ("use of %s from containing function",
(TREE_CODE (decl) == VAR_DECL
! ? "`auto' variable" : "parameter"));
! cp_error_at (" `%#D' declared here", decl);
return error_mark_node;
}
}
--- 2665,2672 ----
{
error ("use of %s from containing function",
(TREE_CODE (decl) == VAR_DECL
! ? "%<auto%> variable" : "parameter"));
! cp_error_at (" %q#D declared here", decl);
return error_mark_node;
}
}
*************** finish_typeof (tree expr)
*** 2717,2723 ****
if (!type || type == unknown_type_node)
{
! error ("type of `%E' is unknown", expr);
return error_mark_node;
}
--- 2717,2723 ----
if (!type || type == unknown_type_node)
{
! error ("type of %qE is unknown", expr);
return error_mark_node;
}
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.414
diff -p -r1.414 tree.c
*** cp/tree.c 10 Oct 2004 05:02:53 -0000 1.414
--- cp/tree.c 10 Oct 2004 21:22:37 -0000
*************** cp_build_qualified_type_real (tree type,
*** 536,542 ****
tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
if (!(complain & tf_ignore_bad_quals))
! error ("`%V' qualifiers cannot be applied to `%T'",
bad_type, type);
}
}
--- 536,542 ----
tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
if (!(complain & tf_ignore_bad_quals))
! error ("%qV qualifiers cannot be applied to %qT",
bad_type, type);
}
}
*************** handle_java_interface_attribute (tree* n
*** 1771,1777 ****
|| !CLASS_TYPE_P (*node)
|| !TYPE_FOR_JAVA (*node))
{
! error ("`%E' attribute can only be applied to Java class definitions",
name);
*no_add_attrs = true;
return NULL_TREE;
--- 1771,1777 ----
|| !CLASS_TYPE_P (*node)
|| !TYPE_FOR_JAVA (*node))
{
! error ("%qE attribute can only be applied to Java class definitions",
name);
*no_add_attrs = true;
return NULL_TREE;
*************** handle_com_interface_attribute (tree* no
*** 1800,1812 ****
|| !CLASS_TYPE_P (*node)
|| *node != TYPE_MAIN_VARIANT (*node))
{
! warning ("`%E' attribute can only be applied to class definitions",
! name);
return NULL_TREE;
}
if (!warned++)
! warning ("`%E' is obsolete; g++ vtables are now COM-compatible by default",
name);
return NULL_TREE;
--- 1800,1811 ----
|| !CLASS_TYPE_P (*node)
|| *node != TYPE_MAIN_VARIANT (*node))
{
! warning ("%qE attribute can only be applied to class definitions", name);
return NULL_TREE;
}
if (!warned++)
! warning ("%qE is obsolete; g++ vtables are now COM-compatible by default",
name);
return NULL_TREE;
*************** handle_init_priority_attribute (tree* no
*** 1851,1857 ****
init_priority value, so don't allow it. */
|| current_function_decl)
{
! error ("can only use `%E' attribute on file-scope definitions "
"of objects of class type", name);
*no_add_attrs = true;
return NULL_TREE;
--- 1850,1856 ----
init_priority value, so don't allow it. */
|| current_function_decl)
{
! error ("can only use %qE attribute on file-scope definitions "
"of objects of class type", name);
*no_add_attrs = true;
return NULL_TREE;
*************** handle_init_priority_attribute (tree* no
*** 1879,1885 ****
}
else
{
! error ("`%E' attribute is not supported on this platform", name);
*no_add_attrs = true;
return NULL_TREE;
}
--- 1878,1884 ----
}
else
{
! error ("%qE attribute is not supported on this platform", name);
*no_add_attrs = true;
return NULL_TREE;
}
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.580
diff -p -r1.580 typeck.c
*** cp/typeck.c 3 Oct 2004 18:07:56 -0000 1.580
--- cp/typeck.c 10 Oct 2004 21:22:40 -0000
*************** composite_pointer_type_r (tree t1, tree
*** 431,437 ****
result_type = composite_pointer_type_r (pointee1, pointee2, location);
else
{
! pedwarn ("%s between distinct pointer types `%T' and `%T' "
"lacks a cast",
location, t1, t2);
result_type = void_type_node;
--- 431,437 ----
result_type = composite_pointer_type_r (pointee1, pointee2, location);
else
{
! pedwarn ("%s between distinct pointer types %qT and %qT "
"lacks a cast",
location, t1, t2);
result_type = void_type_node;
*************** composite_pointer_type_r (tree t1, tree
*** 445,451 ****
{
if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2)))
! pedwarn ("%s between distinct pointer types `%T' and `%T' "
"lacks a cast",
location, t1, t2);
result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
--- 445,451 ----
{
if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2)))
! pedwarn ("%s between distinct pointer types %qT and %qT "
"lacks a cast",
location, t1, t2);
result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
*************** composite_pointer_type (tree t1, tree t2
*** 507,513 ****
tree result_type;
if (pedantic && TYPE_PTRFN_P (t2))
! pedwarn ("ISO C++ forbids %s between pointer of type `void *' and pointer-to-function", location);
result_type
= cp_build_qualified_type (void_type_node,
(cp_type_quals (TREE_TYPE (t1))
--- 507,514 ----
tree result_type;
if (pedantic && TYPE_PTRFN_P (t2))
! pedwarn ("ISO C++ forbids %s between pointer of type %<void *%> "
! "and pointer-to-function", location);
result_type
= cp_build_qualified_type (void_type_node,
(cp_type_quals (TREE_TYPE (t1))
*************** composite_pointer_type (tree t1, tree t2
*** 537,543 ****
(cp_build_qualified_type (class2, TYPE_QUALS (class1))));
else
{
! error ("%s between distinct pointer types `%T' and `%T' "
"lacks a cast", location, t1, t2);
return error_mark_node;
}
--- 538,544 ----
(cp_build_qualified_type (class2, TYPE_QUALS (class1))));
else
{
! error ("%s between distinct pointer types %qT and %qT "
"lacks a cast", location, t1, t2);
return error_mark_node;
}
*************** composite_pointer_type (tree t1, tree t2
*** 557,563 ****
t2 = build_ptrmem_type (class1, TYPE_PTRMEM_POINTED_TO_TYPE (t2));
else
{
! error ("%s between distinct pointer-to-member types `%T' and `%T' "
"lacks a cast", location, t1, t2);
return error_mark_node;
}
--- 558,564 ----
t2 = build_ptrmem_type (class1, TYPE_PTRMEM_POINTED_TO_TYPE (t2));
else
{
! error ("%s between distinct pointer-to-member types %qT and %qT "
"lacks a cast", location, t1, t2);
return error_mark_node;
}
*************** cxx_sizeof_or_alignof_type (tree type, e
*** 1244,1250 ****
if (type_code == METHOD_TYPE)
{
if (complain && (pedantic || warn_pointer_arith))
! pedwarn ("invalid application of `%s' to a member function", op_name);
value = size_one_node;
}
else
--- 1245,1251 ----
if (type_code == METHOD_TYPE)
{
if (complain && (pedantic || warn_pointer_arith))
! pedwarn ("invalid application of %qs to a member function", op_name);
value = size_one_node;
}
else
*************** cxx_sizeof_or_alignof_expr (tree e, enum
*** 1277,1288 ****
&& TREE_CODE (TREE_OPERAND (e, 1)) == FIELD_DECL
&& DECL_C_BIT_FIELD (TREE_OPERAND (e, 1)))
{
! error ("invalid application of `%s' to a bit-field", op_name);
e = char_type_node;
}
else if (is_overloaded_fn (e))
{
! pedwarn ("ISO C++ forbids applying `%s' to an expression of function type", op_name);
e = char_type_node;
}
else if (type_unknown_p (e))
--- 1278,1290 ----
&& TREE_CODE (TREE_OPERAND (e, 1)) == FIELD_DECL
&& DECL_C_BIT_FIELD (TREE_OPERAND (e, 1)))
{
! error ("invalid application of %qs to a bit-field", op_name);
e = char_type_node;
}
else if (is_overloaded_fn (e))
{
! pedwarn ("ISO C++ forbids applying %qs to an expression of "
! "function type", op_name);
e = char_type_node;
}
else if (type_unknown_p (e))
*************** string_conv_p (tree totype, tree exp, in
*** 1503,1509 ****
/* This warning is not very useful, as it complains about printf. */
if (warn && warn_write_strings)
! warning ("deprecated conversion from string constant to `%T'", totype);
return 1;
}
--- 1505,1511 ----
/* This warning is not very useful, as it complains about printf. */
if (warn && warn_write_strings)
! warning ("deprecated conversion from string constant to %qT'", totype);
return 1;
}
*************** build_class_member_access_expr (tree obj
*** 1617,1623 ****
return error_mark_node;
if (!CLASS_TYPE_P (object_type))
{
! error ("request for member `%D' in `%E', which is of non-class type `%T'",
member, object, object_type);
return error_mark_node;
}
--- 1619,1625 ----
return error_mark_node;
if (!CLASS_TYPE_P (object_type))
{
! error ("request for member %qD in %qE, which is of non-class type %qT",
member, object, object_type);
return error_mark_node;
}
*************** build_class_member_access_expr (tree obj
*** 1644,1652 ****
if (!member_scope || !DERIVED_FROM_P (member_scope, object_type))
{
if (TREE_CODE (member) == FIELD_DECL)
! error ("invalid use of nonstatic data member '%E'", member);
else
! error ("`%D' is not a member of `%T'", member, object_type);
return error_mark_node;
}
--- 1646,1654 ----
if (!member_scope || !DERIVED_FROM_P (member_scope, object_type))
{
if (TREE_CODE (member) == FIELD_DECL)
! error ("invalid use of nonstatic data member %qE", member);
else
! error ("%qD is not a member of %qT", member, object_type);
return error_mark_node;
}
*************** build_class_member_access_expr (tree obj
*** 1696,1704 ****
offsetof macro. */
if (null_object_p && kind == bk_via_virtual)
{
! error ("invalid access to non-static data member `%D' of NULL object",
member);
! error ("(perhaps the `offsetof' macro was used incorrectly)");
return error_mark_node;
}
--- 1698,1707 ----
offsetof macro. */
if (null_object_p && kind == bk_via_virtual)
{
! error ("invalid access to non-static data member %qD of "
! "NULL object",
member);
! error ("(perhaps the %<offsetof%> macro was used incorrectly)");
return error_mark_node;
}
*************** build_class_member_access_expr (tree obj
*** 1723,1731 ****
&& !DECL_FIELD_IS_BASE (member)
&& !skip_evaluation)
{
! warning ("invalid access to non-static data member `%D' of NULL object",
member);
! warning ("(perhaps the `offsetof' macro was used incorrectly)");
}
/* If MEMBER is from an anonymous aggregate, we have converted
--- 1726,1734 ----
&& !DECL_FIELD_IS_BASE (member)
&& !skip_evaluation)
{
! warning ("invalid access to non-static data member %qD of NULL object",
member);
! warning ("(perhaps the %<offsetof%> macro was used incorrectly)");
}
/* If MEMBER is from an anonymous aggregate, we have converted
*************** build_class_member_access_expr (tree obj
*** 1810,1816 ****
}
else
{
! error ("invalid use of `%D'", member);
return error_mark_node;
}
--- 1813,1819 ----
}
else
{
! error ("invalid use of %qD", member);
return error_mark_node;
}
*************** lookup_destructor (tree object, tree sco
*** 1836,1848 ****
if (scope && !check_dtor_name (scope, dtor_name))
{
! error ("qualified type `%T' does not match destructor name `~%T'",
scope, dtor_type);
return error_mark_node;
}
if (!DERIVED_FROM_P (dtor_type, TYPE_MAIN_VARIANT (object_type)))
{
! error ("the type being destroyed is `%T', but the destructor refers to `%T'",
TYPE_MAIN_VARIANT (object_type), dtor_type);
return error_mark_node;
}
--- 1839,1851 ----
if (scope && !check_dtor_name (scope, dtor_name))
{
! error ("qualified type %qT does not match destructor name ~%qT",
scope, dtor_type);
return error_mark_node;
}
if (!DERIVED_FROM_P (dtor_type, TYPE_MAIN_VARIANT (object_type)))
{
! error ("the type being destroyed is %qT, but the destructor refers to %qT",
TYPE_MAIN_VARIANT (object_type), dtor_type);
return error_mark_node;
}
*************** finish_class_member_access_expr (tree ob
*** 1915,1921 ****
return error_mark_node;
if (!CLASS_TYPE_P (object_type))
{
! error ("request for member `%D' in `%E', which is of non-class type `%T'",
name, object, object_type);
return error_mark_node;
}
--- 1918,1924 ----
return error_mark_node;
if (!CLASS_TYPE_P (object_type))
{
! error ("request for member %qD in %qE, which is of non-class type %qT",
name, object, object_type);
return error_mark_node;
}
*************** finish_class_member_access_expr (tree ob
*** 1961,1967 ****
name a member of OBJECT_TYPE. */
if (TREE_CODE (scope) == NAMESPACE_DECL)
{
! error ("`%D::%D' is not a member of `%T'",
scope, name, object_type);
return error_mark_node;
}
--- 1964,1970 ----
name a member of OBJECT_TYPE. */
if (TREE_CODE (scope) == NAMESPACE_DECL)
{
! error ("%<%D::%D%> is not a member of %qT",
scope, name, object_type);
return error_mark_node;
}
*************** finish_class_member_access_expr (tree ob
*** 1972,1978 ****
return error_mark_node;
if (!access_path)
{
! error ("`%T' is not a base of `%T'", scope, object_type);
return error_mark_node;
}
}
--- 1975,1981 ----
return error_mark_node;
if (!access_path)
{
! error ("%qT is not a base of %qT", scope, object_type);
return error_mark_node;
}
}
*************** finish_class_member_access_expr (tree ob
*** 1991,1997 ****
/*want_type=*/false);
if (member == NULL_TREE)
{
! error ("'%D' has no member named '%E'", object_type, name);
return error_mark_node;
}
if (member == error_mark_node)
--- 1994,2000 ----
/*want_type=*/false);
if (member == NULL_TREE)
{
! error ("%qD has no member named %qE", object_type, name);
return error_mark_node;
}
if (member == error_mark_node)
*************** finish_class_member_access_expr (tree ob
*** 2006,2012 ****
template = lookup_template_function (template, template_args);
else
{
! error ("`%D' is not a member template function", name);
return error_mark_node;
}
}
--- 2009,2015 ----
template = lookup_template_function (template, template_args);
else
{
! error ("%qD is not a member template function", name);
return error_mark_node;
}
}
*************** build_indirect_ref (tree ptr, const char
*** 2113,2119 ****
{
/* A pointer to incomplete type (other than cv void) can be
dereferenced [expr.unary.op]/1 */
! error ("`%T' is not a pointer-to-object type", type);
return error_mark_node;
}
else if (TREE_CODE (pointer) == ADDR_EXPR
--- 2116,2122 ----
{
/* A pointer to incomplete type (other than cv void) can be
dereferenced [expr.unary.op]/1 */
! error ("%qT is not a pointer-to-object type", type);
return error_mark_node;
}
else if (TREE_CODE (pointer) == ADDR_EXPR
*************** build_indirect_ref (tree ptr, const char
*** 2138,2148 ****
/* `pointer' won't be an error_mark_node if we were given a
pointer to member, so it's cool to check for this here. */
else if (TYPE_PTR_TO_MEMBER_P (type))
! error ("invalid use of `%s' on pointer to member", errorstring);
else if (pointer != error_mark_node)
{
if (errorstring)
! error ("invalid type argument of `%s'", errorstring);
else
error ("invalid type argument");
}
--- 2141,2151 ----
/* `pointer' won't be an error_mark_node if we were given a
pointer to member, so it's cool to check for this here. */
else if (TYPE_PTR_TO_MEMBER_P (type))
! error ("invalid use of %qs on pointer to member", errorstring);
else if (pointer != error_mark_node)
{
if (errorstring)
! error ("invalid type argument of %qs", errorstring);
else
error ("invalid type argument");
}
*************** build_array_ref (tree array, tree idx)
*** 2208,2214 ****
must have done so deliberately. */
if (warn_char_subscripts
&& TYPE_MAIN_VARIANT (TREE_TYPE (idx)) == char_type_node)
! warning ("array subscript has type `char'");
if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (idx)))
{
--- 2211,2217 ----
must have done so deliberately. */
if (warn_char_subscripts
&& TYPE_MAIN_VARIANT (TREE_TYPE (idx)) == char_type_node)
! warning ("array subscript has type %<char%>");
if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (idx)))
{
*************** build_array_ref (tree array, tree idx)
*** 2260,2266 ****
while (TREE_CODE (foo) == COMPONENT_REF)
foo = TREE_OPERAND (foo, 0);
if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
! warning ("subscripting array declared `register'");
}
type = TREE_TYPE (TREE_TYPE (array));
--- 2263,2269 ----
while (TREE_CODE (foo) == COMPONENT_REF)
foo = TREE_OPERAND (foo, 0);
if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
! warning ("subscripting array declared %<register%>");
}
type = TREE_TYPE (TREE_TYPE (array));
*************** get_member_function_from_ptrfunc (tree *
*** 2343,2349 ****
}
else
{
! error ("object missing in use of `%E'", function);
return error_mark_node;
}
}
--- 2346,2352 ----
}
else
{
! error ("object missing in use of %qE", function);
return error_mark_node;
}
}
*************** build_function_call (tree function, tree
*** 2444,2450 ****
/* Convert anything with function type to a pointer-to-function. */
if (pedantic && DECL_MAIN_P (function))
! pedwarn ("ISO C++ forbids calling `::main' from within program");
/* Differs from default_conversion by not setting TREE_ADDRESSABLE
(because calling an inline function does not mean the function
--- 2447,2453 ----
/* Convert anything with function type to a pointer-to-function. */
if (pedantic && DECL_MAIN_P (function))
! pedwarn ("ISO C++ forbids calling %<::main%> from within program");
/* Differs from default_conversion by not setting TREE_ADDRESSABLE
(because calling an inline function does not mean the function
*************** build_function_call (tree function, tree
*** 2469,2476 ****
if (TYPE_PTRMEMFUNC_P (fntype))
{
! error ("must use .* or ->* to call pointer-to-member function in `%E (...)'",
! original);
return error_mark_node;
}
--- 2472,2480 ----
if (TYPE_PTRMEMFUNC_P (fntype))
{
! error ("must use %<.*%> or %<->*%> to call pointer-to-member "
! "function in %<%E (...)%>",
! original);
return error_mark_node;
}
*************** build_function_call (tree function, tree
*** 2482,2488 ****
|| is_method
|| TREE_CODE (function) == TEMPLATE_ID_EXPR))
{
! error ("`%E' cannot be used as a function", original);
return error_mark_node;
}
--- 2486,2492 ----
|| is_method
|| TREE_CODE (function) == TEMPLATE_ID_EXPR))
{
! error ("%qE cannot be used as a function", original);
return error_mark_node;
}
*************** convert_arguments (tree typelist, tree v
*** 2561,2567 ****
{
if (fndecl)
{
! cp_error_at ("too many arguments to %s `%+#D'", called_thing,
fndecl);
error ("at this point in file");
}
--- 2565,2571 ----
{
if (fndecl)
{
! cp_error_at ("too many arguments to %s %q+#D", called_thing,
fndecl);
error ("at this point in file");
}
*************** convert_arguments (tree typelist, tree v
*** 2600,2609 ****
if (!COMPLETE_TYPE_P (complete_type (type)))
{
if (fndecl)
! error ("parameter %P of `%D' has incomplete type `%T'",
i, fndecl, type);
else
! error ("parameter %P has incomplete type `%T'", i, type);
parmval = error_mark_node;
}
else
--- 2604,2613 ----
if (!COMPLETE_TYPE_P (complete_type (type)))
{
if (fndecl)
! error ("parameter %P of %qD has incomplete type %qT",
i, fndecl, type);
else
! error ("parameter %P has incomplete type %qT", i, type);
parmval = error_mark_node;
}
else
*************** convert_arguments (tree typelist, tree v
*** 2667,2673 ****
{
if (fndecl)
{
! cp_error_at ("too few arguments to %s `%+#D'",
called_thing, fndecl);
error ("at this point in file");
}
--- 2671,2677 ----
{
if (fndecl)
{
! cp_error_at ("too few arguments to %s %q+#D",
called_thing, fndecl);
error ("at this point in file");
}
*************** build_binary_op (enum tree_code code, tr
*** 2819,2826 ****
tree t = instantiate_type (TREE_TYPE (op1), op0, tf_none);
if (t != error_mark_node)
{
! pedwarn ("assuming cast to type `%T' from overloaded function",
! TREE_TYPE (t));
op0 = t;
}
}
--- 2823,2830 ----
tree t = instantiate_type (TREE_TYPE (op1), op0, tf_none);
if (t != error_mark_node)
{
! pedwarn ("assuming cast to type %qT from overloaded function",
! TREE_TYPE (t));
op0 = t;
}
}
*************** build_binary_op (enum tree_code code, tr
*** 2829,2836 ****
tree t = instantiate_type (TREE_TYPE (op0), op1, tf_none);
if (t != error_mark_node)
{
! pedwarn ("assuming cast to type `%T' from overloaded function",
! TREE_TYPE (t));
op1 = t;
}
}
--- 2833,2840 ----
tree t = instantiate_type (TREE_TYPE (op0), op1, tf_none);
if (t != error_mark_node)
{
! pedwarn ("assuming cast to type %qT from overloaded function",
! TREE_TYPE (t));
op1 = t;
}
}
*************** build_binary_op (enum tree_code code, tr
*** 2890,2898 ****
|| code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE))
{
if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1))
! warning ("division by zero in `%E / 0'", op0);
else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1))
! warning ("division by zero in `%E / 0.'", op0);
if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE)
code0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0)));
--- 2894,2902 ----
|| code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE))
{
if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1))
! warning ("division by zero in %<%E / 0%>", op0);
else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1))
! warning ("division by zero in %<%E / 0.%>", op0);
if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE)
code0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0)));
*************** build_binary_op (enum tree_code code, tr
*** 2926,2934 ****
case TRUNC_MOD_EXPR:
case FLOOR_MOD_EXPR:
if (code1 == INTEGER_TYPE && integer_zerop (op1))
! warning ("division by zero in `%E %% 0'", op0);
else if (code1 == REAL_TYPE && real_zerop (op1))
! warning ("division by zero in `%E %% 0.'", op0);
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
{
--- 2930,2938 ----
case TRUNC_MOD_EXPR:
case FLOOR_MOD_EXPR:
if (code1 == INTEGER_TYPE && integer_zerop (op1))
! warning ("division by zero in %<%E %% 0%>", op0);
else if (code1 == REAL_TYPE && real_zerop (op1))
! warning ("division by zero in %<%E %% 0.%>", op0);
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
{
*************** build_binary_op (enum tree_code code, tr
*** 3187,3193 ****
if (!result_type)
{
! error ("invalid operands of types `%T' and `%T' to binary `%O'",
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code);
return error_mark_node;
}
--- 3191,3197 ----
if (!result_type)
{
! error ("invalid operands of types %qT and %qT to binary %qO",
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code);
return error_mark_node;
}
*************** build_binary_op (enum tree_code code, tr
*** 3349,3356 ****
&& TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
{
! warning ("comparison between types `%#T' and `%#T'",
! TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
}
/* Give warnings for comparisons between signed and unsigned
--- 3353,3360 ----
&& TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
{
! warning ("comparison between types %q#T and %q#T",
! TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
}
/* Give warnings for comparisons between signed and unsigned
*************** pointer_diff (tree op0, tree op1, tree p
*** 3522,3528 ****
if (pedantic || warn_pointer_arith)
{
if (TREE_CODE (target_type) == VOID_TYPE)
! pedwarn ("ISO C++ forbids using pointer of type `void *' in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE)
pedwarn ("ISO C++ forbids using pointer to a function in subtraction");
if (TREE_CODE (target_type) == METHOD_TYPE)
--- 3526,3532 ----
if (pedantic || warn_pointer_arith)
{
if (TREE_CODE (target_type) == VOID_TYPE)
! pedwarn ("ISO C++ forbids using pointer of type %<void *%> in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE)
pedwarn ("ISO C++ forbids using pointer to a function in subtraction");
if (TREE_CODE (target_type) == METHOD_TYPE)
*************** build_unary_op (enum tree_code code, tre
*** 3884,3899 ****
tree type = complete_type (TREE_TYPE (argtype));
if (!COMPLETE_OR_VOID_TYPE_P (type))
! error ("cannot %s a pointer to incomplete type `%T'",
! ((code == PREINCREMENT_EXPR
! || code == POSTINCREMENT_EXPR)
! ? "increment" : "decrement"), TREE_TYPE (argtype));
else if ((pedantic || warn_pointer_arith)
&& !TYPE_PTROB_P (argtype))
! pedwarn ("ISO C++ forbids %sing a pointer of type `%T'",
! ((code == PREINCREMENT_EXPR
! || code == POSTINCREMENT_EXPR)
! ? "increment" : "decrement"), argtype);
inc = cxx_sizeof_nowarn (TREE_TYPE (argtype));
}
else
--- 3888,3903 ----
tree type = complete_type (TREE_TYPE (argtype));
if (!COMPLETE_OR_VOID_TYPE_P (type))
! error ("cannot %s a pointer to incomplete type %qT",
! ((code == PREINCREMENT_EXPR
! || code == POSTINCREMENT_EXPR)
! ? "increment" : "decrement"), TREE_TYPE (argtype));
else if ((pedantic || warn_pointer_arith)
&& !TYPE_PTROB_P (argtype))
! pedwarn ("ISO C++ forbids %sing a pointer of type %qT",
! ((code == PREINCREMENT_EXPR
! || code == POSTINCREMENT_EXPR)
! ? "increment" : "decrement"), argtype);
inc = cxx_sizeof_nowarn (TREE_TYPE (argtype));
}
else
*************** build_unary_op (enum tree_code code, tre
*** 3950,3956 ****
{
if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
{
! error ("invalid use of `--' on bool variable `%D'", arg);
return error_mark_node;
}
val = boolean_increment (code, arg);
--- 3954,3960 ----
{
if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
{
! error ("invalid use of %<--%> on bool variable %qD", arg);
return error_mark_node;
}
val = boolean_increment (code, arg);
*************** build_unary_op (enum tree_code code, tre
*** 3979,3985 ****
}
else if (pedantic && DECL_MAIN_P (arg))
/* ARM $3.4 */
! pedwarn ("ISO C++ forbids taking address of function `::main'");
/* Let &* cancel out to simplify resulting code. */
if (TREE_CODE (arg) == INDIRECT_REF)
--- 3983,3989 ----
}
else if (pedantic && DECL_MAIN_P (arg))
/* ARM $3.4 */
! pedwarn ("ISO C++ forbids taking address of function %<::main%>");
/* Let &* cancel out to simplify resulting code. */
if (TREE_CODE (arg) == INDIRECT_REF)
*************** build_unary_op (enum tree_code code, tre
*** 4035,4046 ****
/* An expression like &memfn. */
pedwarn ("ISO C++ forbids taking the address of an unqualified"
" or parenthesized non-static member function to form"
! " a pointer to member function. Say `&%T::%D'",
base, name);
else
pedwarn ("ISO C++ forbids taking the address of a bound member"
" function to form a pointer to member function."
! " Say `&%T::%D'",
base, name);
}
arg = build_offset_ref (base, name, /*address_p=*/true);
--- 4039,4050 ----
/* An expression like &memfn. */
pedwarn ("ISO C++ forbids taking the address of an unqualified"
" or parenthesized non-static member function to form"
! " a pointer to member function. Say %<&%T::%D%>",
base, name);
else
pedwarn ("ISO C++ forbids taking the address of a bound member"
" function to form a pointer to member function."
! " Say %<&%T::%D%>",
base, name);
}
arg = build_offset_ref (base, name, /*address_p=*/true);
*************** build_unary_op (enum tree_code code, tre
*** 4086,4092 ****
is an error. */
else if (TREE_CODE (argtype) != FUNCTION_TYPE
&& TREE_CODE (argtype) != METHOD_TYPE
! && !lvalue_or_else (arg, "unary `&'"))
return error_mark_node;
if (argtype != error_mark_node)
--- 4090,4096 ----
is an error. */
else if (TREE_CODE (argtype) != FUNCTION_TYPE
&& TREE_CODE (argtype) != METHOD_TYPE
! && !lvalue_or_else (arg, "unary %<&$>"))
return error_mark_node;
if (argtype != error_mark_node)
*************** build_unary_op (enum tree_code code, tre
*** 4118,4124 ****
}
else if (DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1)))
{
! error ("attempt to take address of bit-field structure member `%D'",
TREE_OPERAND (arg, 1));
return error_mark_node;
}
--- 4122,4128 ----
}
else if (DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1)))
{
! error ("attempt to take address of bit-field structure member %qD",
TREE_OPERAND (arg, 1));
return error_mark_node;
}
*************** unary_complex_lvalue (enum tree_code cod
*** 4251,4257 ****
if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
{
! error ("cannot create pointer to reference member `%D'", t);
return error_mark_node;
}
--- 4255,4261 ----
if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
{
! error ("cannot create pointer to reference member %qD", t);
return error_mark_node;
}
*************** cxx_mark_addressable (tree exp)
*** 4333,4340 ****
case RESULT_DECL:
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& !DECL_ARTIFICIAL (x) && extra_warnings)
! warning ("address requested for `%D', which is declared `register'",
! x);
TREE_ADDRESSABLE (x) = 1;
return true;
--- 4337,4344 ----
case RESULT_DECL:
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& !DECL_ARTIFICIAL (x) && extra_warnings)
! warning ("address requested for %qD, which is declared `register'",
! x);
TREE_ADDRESSABLE (x) = 1;
return true;
*************** check_for_casting_away_constness (tree s
*** 4473,4479 ****
const char *description)
{
if (casts_away_constness (src_type, dest_type))
! error ("%s from type `%T' to type `%T' casts away constness",
description, src_type, dest_type);
}
--- 4477,4483 ----
const char *description)
{
if (casts_away_constness (src_type, dest_type))
! error ("%s from type %qT to type %qT casts away constness",
description, src_type, dest_type);
}
*************** build_static_cast (tree type, tree expr)
*** 4675,4681 ****
return build_nop (type, expr);
}
! error ("invalid static_cast from type `%T' to type `%T'", intype, type);
return error_mark_node;
}
--- 4679,4685 ----
return build_nop (type, expr);
}
! error ("invalid static_cast from type %qT to type %qT", intype, type);
return error_mark_node;
}
*************** build_reinterpret_cast (tree type, tree
*** 4718,4724 ****
{
if (! real_lvalue_p (expr))
{
! error ("invalid reinterpret_cast of an rvalue expression of type `%T' to type `%T'", intype, type);
return error_mark_node;
}
expr = build_unary_op (ADDR_EXPR, expr, 0);
--- 4722,4729 ----
{
if (! real_lvalue_p (expr))
{
! error ("invalid reinterpret_cast of an rvalue expression of type "
! "%qT to type %qT", intype, type);
return error_mark_node;
}
expr = build_unary_op (ADDR_EXPR, expr, 0);
*************** build_reinterpret_cast (tree type, tree
*** 4738,4745 ****
else if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PTR_P (intype))
{
if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
! pedwarn ("reinterpret_cast from `%T' to `%T' loses precision",
! intype, type);
}
else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
--- 4743,4750 ----
else if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PTR_P (intype))
{
if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
! pedwarn ("reinterpret_cast from %qT to %qT loses precision",
! intype, type);
}
else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
*************** build_reinterpret_cast (tree type, tree
*** 4763,4770 ****
}
else
{
! error ("invalid reinterpret_cast from type `%T' to type `%T'",
! intype, type);
return error_mark_node;
}
--- 4768,4775 ----
}
else
{
! error ("invalid reinterpret_cast from type %qT to type %qT",
! intype, type);
return error_mark_node;
}
*************** build_const_cast (tree type, tree expr)
*** 4791,4800 ****
}
if (!POINTER_TYPE_P (type) && !TYPE_PTRMEM_P (type))
! error ("invalid use of const_cast with type `%T', which is not a pointer, reference, nor a pointer-to-data-member type", type);
else if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{
! error ("invalid use of const_cast with type `%T', which is a pointer or reference to a function type", type);
return error_mark_node;
}
--- 4796,4807 ----
}
if (!POINTER_TYPE_P (type) && !TYPE_PTRMEM_P (type))
! error ("invalid use of const_cast with type %qT, which is not a pointer, "
! "reference, nor a pointer-to-data-member type", type);
else if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{
! error ("invalid use of const_cast with type %qT, which is a pointer "
! "or reference to a function type", type);
return error_mark_node;
}
*************** build_const_cast (tree type, tree expr)
*** 4817,4823 ****
{
if (! real_lvalue_p (expr))
{
! error ("invalid const_cast of an rvalue of type `%T' to type `%T'", intype, type);
return error_mark_node;
}
--- 4824,4831 ----
{
if (! real_lvalue_p (expr))
{
! error ("invalid const_cast of an rvalue of type %qT to type %qT",
! intype, type);
return error_mark_node;
}
*************** build_const_cast (tree type, tree expr)
*** 4834,4840 ****
&& comp_ptr_ttypes_const (TREE_TYPE (type), TREE_TYPE (intype)))
return cp_convert (type, expr);
! error ("invalid const_cast from type `%T' to type `%T'", intype, type);
return error_mark_node;
}
--- 4842,4848 ----
&& comp_ptr_ttypes_const (TREE_TYPE (type), TREE_TYPE (intype)))
return cp_convert (type, expr);
! error ("invalid const_cast from type %qT to type %qT", intype, type);
return error_mark_node;
}
*************** build_c_cast (tree type, tree expr)
*** 4881,4892 ****
NIHCL uses it. It is not valid ISO C++ however. */
if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
{
! pedwarn ("ISO C++ forbids casting to an array type `%T'", type);
type = build_pointer_type (TREE_TYPE (type));
}
else
{
! error ("ISO C++ forbids casting to an array type `%T'", type);
return error_mark_node;
}
}
--- 4889,4900 ----
NIHCL uses it. It is not valid ISO C++ however. */
if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
{
! pedwarn ("ISO C++ forbids casting to an array type %qT", type);
type = build_pointer_type (TREE_TYPE (type));
}
else
{
! error ("ISO C++ forbids casting to an array type %qT", type);
return error_mark_node;
}
}
*************** build_c_cast (tree type, tree expr)
*** 4894,4900 ****
if (TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE)
{
! error ("invalid cast to function type `%T'", type);
return error_mark_node;
}
--- 4902,4908 ----
if (TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE)
{
! error ("invalid cast to function type %qT", type);
return error_mark_node;
}
*************** build_c_cast (tree type, tree expr)
*** 4950,4957 ****
&& TREE_CODE (otype) == POINTER_TYPE
&& !at_least_as_qualified_p (TREE_TYPE (type),
TREE_TYPE (otype)))
! warning ("cast from `%T' to `%T' discards qualifiers from pointer target type",
! otype, type);
if (TREE_CODE (type) == INTEGER_TYPE
&& TYPE_PTR_P (otype)
--- 4958,4966 ----
&& TREE_CODE (otype) == POINTER_TYPE
&& !at_least_as_qualified_p (TREE_TYPE (type),
TREE_TYPE (otype)))
! warning ("cast from %qT to %qT discards qualifiers from pointer "
! "target type",
! otype, type);
if (TREE_CODE (type) == INTEGER_TYPE
&& TYPE_PTR_P (otype)
*************** build_c_cast (tree type, tree expr)
*** 4998,5005 ****
&& COMPLETE_TYPE_P (TREE_TYPE (otype))
&& COMPLETE_TYPE_P (TREE_TYPE (type))
&& TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
! warning ("cast from `%T' to `%T' increases required alignment of target type",
! otype, type);
/* Always produce some operator for an explicit cast,
so we can tell (for -pedantic) that the cast is no lvalue. */
--- 5007,5015 ----
&& COMPLETE_TYPE_P (TREE_TYPE (otype))
&& COMPLETE_TYPE_P (TREE_TYPE (type))
&& TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
! warning ("cast from %qT to %qT increases required alignment of "
! "target type",
! otype, type);
/* Always produce some operator for an explicit cast,
so we can tell (for -pedantic) that the cast is no lvalue. */
*************** build_modify_expr (tree lhs, enum tree_c
*** 5183,5189 ****
newrhs = cp_build_binary_op (modifycode, lhs, rhs);
if (newrhs == error_mark_node)
{
! error (" in evaluation of `%Q(%#T, %#T)'", modifycode,
TREE_TYPE (lhs), TREE_TYPE (rhs));
return error_mark_node;
}
--- 5193,5199 ----
newrhs = cp_build_binary_op (modifycode, lhs, rhs);
if (newrhs == error_mark_node)
{
! error (" in evaluation of %<%Q(%#T, %#T)%>", modifycode,
TREE_TYPE (lhs), TREE_TYPE (rhs));
return error_mark_node;
}
*************** build_modify_expr (tree lhs, enum tree_c
*** 5252,5258 ****
if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),
TYPE_MAIN_VARIANT (TREE_TYPE (rhs))))
{
! error ("incompatible types in assignment of `%T' to `%T'",
TREE_TYPE (rhs), lhstype);
return error_mark_node;
}
--- 5262,5268 ----
if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),
TYPE_MAIN_VARIANT (TREE_TYPE (rhs))))
{
! error ("incompatible types in assignment of %qT to %qT",
TREE_TYPE (rhs), lhstype);
return error_mark_node;
}
*************** get_delta_difference (tree from, tree to
*** 5398,5407 ****
{
/* This is a reinterpret cast, we choose to do nothing. */
if (force)
! warning ("pointer to member cast via virtual base `%T'",
BINFO_TYPE (virt_binfo));
else
! error ("pointer to member conversion via virtual base `%T'",
BINFO_TYPE (virt_binfo));
}
}
--- 5408,5417 ----
{
/* This is a reinterpret cast, we choose to do nothing. */
if (force)
! warning ("pointer to member cast via virtual base %qT",
BINFO_TYPE (virt_binfo));
else
! error ("pointer to member conversion via virtual base %qT",
BINFO_TYPE (virt_binfo));
}
}
*************** build_ptrmemfunc (tree type, tree pfn, i
*** 5474,5481 ****
if (!force
&& !can_convert_arg (to_type, TREE_TYPE (pfn), pfn))
! error ("invalid conversion to type `%T' from type `%T'",
! to_type, pfn_type);
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
--- 5484,5491 ----
if (!force
&& !can_convert_arg (to_type, TREE_TYPE (pfn), pfn))
! error ("invalid conversion to type %qT from type %qT",
! to_type, pfn_type);
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
*************** dubious_conversion_warnings (tree type,
*** 5636,5645 ****
if (ARITHMETIC_TYPE_P (type) && expr == null_node)
{
if (fndecl)
! warning ("passing NULL used for non-pointer %s %P of `%D'",
! errtype, parmnum, fndecl);
else
! warning ("%s to non-pointer type `%T' from NULL", errtype, type);
}
/* Warn about assigning a floating-point type to an integer type. */
--- 5646,5655 ----
if (ARITHMETIC_TYPE_P (type) && expr == null_node)
{
if (fndecl)
! warning ("passing NULL used for non-pointer %s %P of %qD",
! errtype, parmnum, fndecl);
else
! warning ("%s to non-pointer type %qT from NULL", errtype, type);
}
/* Warn about assigning a floating-point type to an integer type. */
*************** dubious_conversion_warnings (tree type,
*** 5647,5656 ****
&& TREE_CODE (type) == INTEGER_TYPE)
{
if (fndecl)
! warning ("passing `%T' for %s %P of `%D'",
! TREE_TYPE (expr), errtype, parmnum, fndecl);
else
! warning ("%s to `%T' from `%T'", errtype, type, TREE_TYPE (expr));
}
/* And warn about assigning a negative value to an unsigned
variable. */
--- 5657,5666 ----
&& TREE_CODE (type) == INTEGER_TYPE)
{
if (fndecl)
! warning ("passing %qT for %s %P of %qD",
! TREE_TYPE (expr), errtype, parmnum, fndecl);
else
! warning ("%s to %qT from %qT", errtype, type, TREE_TYPE (expr));
}
/* And warn about assigning a negative value to an unsigned
variable. */
*************** dubious_conversion_warnings (tree type,
*** 5659,5669 ****
if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr))
{
if (fndecl)
! warning ("passing negative value `%E' for %s %P of `%D'",
! expr, errtype, parmnum, fndecl);
else
! warning ("%s of negative value `%E' to `%T'",
! errtype, expr, type);
}
overflow_warning (expr);
--- 5669,5678 ----
if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr))
{
if (fndecl)
! warning ("passing negative value %qE for %s %P of %qD",
! expr, errtype, parmnum, fndecl);
else
! warning ("%s of negative value %qE to %qT", errtype, expr, type);
}
overflow_warning (expr);
*************** convert_for_assignment (tree type, tree
*** 5749,5759 ****
if (rhstype == unknown_type_node)
instantiate_type (type, rhs, tf_error | tf_warning);
else if (fndecl)
! error ("cannot convert `%T' to `%T' for argument `%P' to `%D'",
! rhstype, type, parmnum, fndecl);
else
! error ("cannot convert `%T' to `%T' in %s", rhstype, type,
! errtype);
return error_mark_node;
}
}
--- 5758,5767 ----
if (rhstype == unknown_type_node)
instantiate_type (type, rhs, tf_error | tf_warning);
else if (fndecl)
! error ("cannot convert %qT to %qT for argument %qP to %qD",
! rhstype, type, parmnum, fndecl);
else
! error ("cannot convert %qT to %qT in %s", rhstype, type, errtype);
return error_mark_node;
}
}
*************** convert_for_initialization (tree exp, tr
*** 5829,5837 ****
if (fndecl)
{
if (warningcount > savew)
! cp_warning_at ("in passing argument %P of `%+D'", parmnum, fndecl);
else if (errorcount > savee)
! cp_error_at ("in passing argument %P of `%+D'", parmnum, fndecl);
}
return rhs;
}
--- 5837,5845 ----
if (fndecl)
{
if (warningcount > savew)
! cp_warning_at ("in passing argument %P of %q+D", parmnum, fndecl);
else if (errorcount > savee)
! cp_error_at ("in passing argument %P of %q+D", parmnum, fndecl);
}
return rhs;
}
*************** maybe_warn_about_returning_address_of_lo
*** 5900,5909 ****
|| TREE_PUBLIC (whats_returned)))
{
if (TREE_CODE (valtype) == REFERENCE_TYPE)
! cp_warning_at ("reference to local variable `%D' returned",
whats_returned);
else
! cp_warning_at ("address of local variable `%D' returned",
whats_returned);
return;
}
--- 5908,5917 ----
|| TREE_PUBLIC (whats_returned)))
{
if (TREE_CODE (valtype) == REFERENCE_TYPE)
! cp_warning_at ("reference to local variable %qD returned",
whats_returned);
else
! cp_warning_at ("address of local variable %qD returned",
whats_returned);
return;
}
*************** check_return_expr (tree retval)
*** 6006,6012 ****
&& !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
&& ! flag_check_new
&& null_ptr_cst_p (retval))
! warning ("`operator new' must not return NULL unless it is declared `throw()' (or -fcheck-new is in effect)");
/* Effective C++ rule 15. See also start_function. */
if (warn_ecpp
--- 6014,6021 ----
&& !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
&& ! flag_check_new
&& null_ptr_cst_p (retval))
! warning ("%<operator new%> must not return NULL unless it is "
! "declared %<throw()%> (or -fcheck-new is in effect)");
/* Effective C++ rule 15. See also start_function. */
if (warn_ecpp
*************** check_return_expr (tree retval)
*** 6031,6037 ****
}
if (warn)
! warning ("`operator=' should return a reference to `*this'");
}
/* The fabled Named Return Value optimization, as per [class.copy]/15:
--- 6040,6046 ----
}
if (warn)
! warning ("%<operator=%> should return a reference to %<*this%>");
}
/* The fabled Named Return Value optimization, as per [class.copy]/15:
Index: cp/typeck2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck2.c,v
retrieving revision 1.175
diff -p -r1.175 typeck2.c
*** cp/typeck2.c 21 Sep 2004 15:39:00 -0000 1.175
--- cp/typeck2.c 10 Oct 2004 21:22:41 -0000
*************** error_not_base_type (tree basetype, tree
*** 49,55 ****
{
if (TREE_CODE (basetype) == FUNCTION_DECL)
basetype = DECL_CONTEXT (basetype);
! error ("type `%T' is not a base type for type `%T'", basetype, type);
return error_mark_node;
}
--- 49,55 ----
{
if (TREE_CODE (basetype) == FUNCTION_DECL)
basetype = DECL_CONTEXT (basetype);
! error ("type %qT is not a base type for type %qT", basetype, type);
return error_mark_node;
}
*************** readonly_error (tree arg, const char* st
*** 84,92 ****
if (TREE_CODE (arg) == COMPONENT_REF)
{
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
! fmt = "%s of data-member `%D' in read-only structure";
else
! fmt = "%s of read-only data-member `%D'";
(*fn) (fmt, string, TREE_OPERAND (arg, 1));
}
else if (TREE_CODE (arg) == VAR_DECL)
--- 84,92 ----
if (TREE_CODE (arg) == COMPONENT_REF)
{
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
! fmt = "%s of data-member %qD in read-only structure";
else
! fmt = "%s of read-only data-member %qD";
(*fn) (fmt, string, TREE_OPERAND (arg, 1));
}
else if (TREE_CODE (arg) == VAR_DECL)
*************** readonly_error (tree arg, const char* st
*** 94,115 ****
if (DECL_LANG_SPECIFIC (arg)
&& DECL_IN_AGGR_P (arg)
&& !TREE_STATIC (arg))
! fmt = "%s of constant field `%D'";
else
! fmt = "%s of read-only variable `%D'";
(*fn) (fmt, string, arg);
}
else if (TREE_CODE (arg) == PARM_DECL)
! (*fn) ("%s of read-only parameter `%D'", string, arg);
else if (TREE_CODE (arg) == INDIRECT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
! (*fn) ("%s of read-only reference `%D'", string, TREE_OPERAND (arg, 0));
else if (TREE_CODE (arg) == RESULT_DECL)
! (*fn) ("%s of read-only named return value `%D'", string, arg);
else if (TREE_CODE (arg) == FUNCTION_DECL)
! (*fn) ("%s of function `%D'", string, arg);
else
(*fn) ("%s of read-only location", string);
}
--- 94,115 ----
if (DECL_LANG_SPECIFIC (arg)
&& DECL_IN_AGGR_P (arg)
&& !TREE_STATIC (arg))
! fmt = "%s of constant field %qD";
else
! fmt = "%s of read-only variable %qD";
(*fn) (fmt, string, arg);
}
else if (TREE_CODE (arg) == PARM_DECL)
! (*fn) ("%s of read-only parameter %qD", string, arg);
else if (TREE_CODE (arg) == INDIRECT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
! (*fn) ("%s of read-only reference %qD", string, TREE_OPERAND (arg, 0));
else if (TREE_CODE (arg) == RESULT_DECL)
! (*fn) ("%s of read-only named return value %qD", string, arg);
else if (TREE_CODE (arg) == FUNCTION_DECL)
! (*fn) ("%s of function %qD", string, arg);
else
(*fn) ("%s of read-only location", string);
}
*************** abstract_virtuals_error (tree decl, tree
*** 289,318 ****
return 0;
if (TREE_CODE (decl) == VAR_DECL)
! cp_error_at ("cannot declare variable `%+D' to be of abstract "
! "type `%T'", decl, type);
else if (TREE_CODE (decl) == PARM_DECL)
! cp_error_at ("cannot declare parameter `%+D' to be of abstract "
! "type `%T'", decl, type);
else if (TREE_CODE (decl) == FIELD_DECL)
! cp_error_at ("cannot declare field `%+D' to be of abstract "
! "type `%T'", decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
! cp_error_at ("invalid abstract return type for member function `%+#D'",
decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
! cp_error_at ("invalid abstract return type for function `%+#D'",
decl);
else if (TREE_CODE (decl) == IDENTIFIER_NODE)
/* Here we do not have location information, so use error instead
of cp_error_at. */
! error ("invalid abstract type `%T' for `%E'", type, decl);
else
! cp_error_at ("invalid abstract type for `%+D'", decl);
}
else
! error ("cannot allocate an object of abstract type `%T'", type);
/* Only go through this once. */
if (VEC_length (tree, pure))
--- 289,318 ----
return 0;
if (TREE_CODE (decl) == VAR_DECL)
! cp_error_at ("cannot declare variable %q+D to be of abstract "
! "type %qT", decl, type);
else if (TREE_CODE (decl) == PARM_DECL)
! cp_error_at ("cannot declare parameter %q+D to be of abstract "
! "type %qT", decl, type);
else if (TREE_CODE (decl) == FIELD_DECL)
! cp_error_at ("cannot declare field %q+D to be of abstract "
! "type %qT", decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
! cp_error_at ("invalid abstract return type for member function %q+#D",
decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
! cp_error_at ("invalid abstract return type for function %q+#D",
decl);
else if (TREE_CODE (decl) == IDENTIFIER_NODE)
/* Here we do not have location information, so use error instead
of cp_error_at. */
! error ("invalid abstract type %qT for %qE", type, decl);
else
! cp_error_at ("invalid abstract type for %q+D", decl);
}
else
! error ("cannot allocate an object of abstract type %qT", type);
/* Only go through this once. */
if (VEC_length (tree, pure))
*************** abstract_virtuals_error (tree decl, tree
*** 321,327 ****
tree fn;
inform ("%J because the following virtual functions are pure "
! "within `%T':", TYPE_MAIN_DECL (type), type);
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
inform ("%J\t%#D", fn, fn);
--- 321,327 ----
tree fn;
inform ("%J because the following virtual functions are pure "
! "within %qT:", TYPE_MAIN_DECL (type), type);
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
inform ("%J\t%#D", fn, fn);
*************** abstract_virtuals_error (tree decl, tree
*** 331,337 ****
VEC_truncate (tree, pure, 0);
}
else
! inform ("%J since type `%T' has pure virtual functions",
TYPE_MAIN_DECL (type), type);
return 1;
--- 331,337 ----
VEC_truncate (tree, pure, 0);
}
else
! inform ("%J since type %qT has pure virtual functions",
TYPE_MAIN_DECL (type), type);
return 1;
*************** cxx_incomplete_type_diagnostic (tree val
*** 374,380 ****
|| TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == FIELD_DECL))
{
! (*p_msg_at) ("`%D' has incomplete type", value);
decl = 1;
}
retry:
--- 374,380 ----
|| TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == FIELD_DECL))
{
! (*p_msg_at) ("%qD has incomplete type", value);
decl = 1;
}
retry:
*************** cxx_incomplete_type_diagnostic (tree val
*** 386,400 ****
case UNION_TYPE:
case ENUMERAL_TYPE:
if (!decl)
! (*p_msg) ("invalid use of undefined type `%#T'", type);
if (!TYPE_TEMPLATE_INFO (type))
! (*p_msg_at) ("forward declaration of `%#T'", type);
else
! (*p_msg_at) ("declaration of `%#T'", type);
break;
case VOID_TYPE:
! (*p_msg) ("invalid use of `%T'", type);
break;
case ARRAY_TYPE:
--- 386,400 ----
case UNION_TYPE:
case ENUMERAL_TYPE:
if (!decl)
! (*p_msg) ("invalid use of undefined type %q#T", type);
if (!TYPE_TEMPLATE_INFO (type))
! (*p_msg_at) ("forward declaration of %q#T", type);
else
! (*p_msg_at) ("declaration of %q#T", type);
break;
case VOID_TYPE:
! (*p_msg) ("invalid use of %qT", type);
break;
case ARRAY_TYPE:
*************** cxx_incomplete_type_diagnostic (tree val
*** 408,414 ****
case OFFSET_TYPE:
bad_member:
! (*p_msg) ("invalid use of member (did you forget the `&' ?)");
break;
case TEMPLATE_TYPE_PARM:
--- 408,414 ----
case OFFSET_TYPE:
bad_member:
! (*p_msg) ("invalid use of member (did you forget the %<&%> ?)");
break;
case TEMPLATE_TYPE_PARM:
*************** cxx_incomplete_type_diagnostic (tree val
*** 419,425 ****
if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR)
! (*p_msg) ("address of overloaded function with no contextual type information");
else if (value && TREE_CODE (value) == OVERLOAD)
(*p_msg) ("overloaded function with no contextual type information");
else
--- 419,426 ----
if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR)
! (*p_msg) ("address of overloaded function with no contextual "
! "type information");
else if (value && TREE_CODE (value) == OVERLOAD)
(*p_msg) ("overloaded function with no contextual type information");
else
*************** store_init_value (tree decl, tree init)
*** 577,583 ****
if (TREE_CODE (init) == TREE_LIST)
{
! error ("constructor syntax used, but no constructor declared for type `%T'", type);
init = build_constructor (NULL_TREE, nreverse (init));
}
}
--- 578,585 ----
if (TREE_CODE (init) == TREE_LIST)
{
! error ("constructor syntax used, but no constructor declared "
! "for type %qT", type);
init = build_constructor (NULL_TREE, nreverse (init));
}
}
*************** digest_init (tree type, tree init, tree*
*** 752,761 ****
}
while (BRACE_ENCLOSED_INITIALIZER_P (init))
{
! pedwarn ("braces around scalar initializer for `%T'", type);
init = CONSTRUCTOR_ELTS (init);
if (TREE_CHAIN (init))
! pedwarn ("ignoring extra initializers for `%T'", type);
init = TREE_VALUE (init);
}
--- 754,763 ----
}
while (BRACE_ENCLOSED_INITIALIZER_P (init))
{
! pedwarn ("braces around scalar initializer for %qT", type);
init = CONSTRUCTOR_ELTS (init);
if (TREE_CHAIN (init))
! pedwarn ("ignoring extra initializers for %qT", type);
init = TREE_VALUE (init);
}
*************** digest_init (tree type, tree init, tree*
*** 767,773 ****
if (COMPLETE_TYPE_P (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
{
! error ("variable-sized object of type `%T' may not be initialized",
type);
return error_mark_node;
}
--- 769,775 ----
if (COMPLETE_TYPE_P (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
{
! error ("variable-sized object of type %qT may not be initialized",
type);
return error_mark_node;
}
*************** digest_init (tree type, tree init, tree*
*** 778,784 ****
{
if (TYPE_NON_AGGREGATE_CLASS (type))
{
! error ("subobject of type `%T' must be initialized by constructor, not by `%E'",
type, init);
return error_mark_node;
}
--- 780,787 ----
{
if (TYPE_NON_AGGREGATE_CLASS (type))
{
! error ("subobject of type %qT must be initialized by "
! "constructor, not by %qE",
type, init);
return error_mark_node;
}
*************** process_init_constructor (tree type, tre
*** 1009,1031 ****
/* Warn when some struct elements are implicitly initialized. */
if (warn_missing_field_initializers
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
! warning ("missing initializer for member `%D'", field);
}
else
{
if (TREE_READONLY (field))
! error ("uninitialized const member `%D'", field);
else if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
! error ("member `%D' with uninitialized const fields",
! field);
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
! error ("member `%D' is uninitialized reference", field);
/* Warn when some struct elements are implicitly initialized
to zero. */
if (warn_missing_field_initializers
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
! warning ("missing initializer for member `%D'", field);
if (! zero_init_p (TREE_TYPE (field)))
next1 = build_zero_init (TREE_TYPE (field),
--- 1012,1033 ----
/* Warn when some struct elements are implicitly initialized. */
if (warn_missing_field_initializers
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
! warning ("missing initializer for member %qD", field);
}
else
{
if (TREE_READONLY (field))
! error ("uninitialized const member %qD", field);
else if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
! error ("member %qD with uninitialized const fields", field);
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
! error ("member %qD is uninitialized reference", field);
/* Warn when some struct elements are implicitly initialized
to zero. */
if (warn_missing_field_initializers
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
! warning ("missing initializer for member %qD", field);
if (! zero_init_p (TREE_TYPE (field)))
next1 = build_zero_init (TREE_TYPE (field),
*************** process_init_constructor (tree type, tre
*** 1078,1093 ****
if (temp)
field = temp, win = 1;
else
! error ("no field `%D' in union being initialized",
! TREE_PURPOSE (tail));
}
if (!win)
TREE_VALUE (tail) = error_mark_node;
}
else if (field == 0)
{
! error ("union `%T' with no named members cannot be initialized",
! type);
TREE_VALUE (tail) = error_mark_node;
}
--- 1080,1095 ----
if (temp)
field = temp, win = 1;
else
! error ("no field %qD in union being initialized",
! TREE_PURPOSE (tail));
}
if (!win)
TREE_VALUE (tail) = error_mark_node;
}
else if (field == 0)
{
! error ("union %qT with no named members cannot be initialized",
! type);
TREE_VALUE (tail) = error_mark_node;
}
*************** build_x_arrow (tree expr)
*** 1248,1254 ****
if (last_rval == NULL_TREE)
{
! error ("base operand of `->' has non-pointer type `%T'", type);
return error_mark_node;
}
--- 1250,1256 ----
if (last_rval == NULL_TREE)
{
! error ("base operand of %<->%> has non-pointer type %qT", type);
return error_mark_node;
}
*************** build_x_arrow (tree expr)
*** 1272,1280 ****
}
if (types_memoized)
! error ("result of `operator->()' yields non-pointer result");
else
! error ("base operand of `->' is not a pointer");
return error_mark_node;
}
--- 1274,1282 ----
}
if (types_memoized)
! error ("result of %<operator->()%> yields non-pointer result");
else
! error ("base operand of %<->%> is not a pointer");
return error_mark_node;
}
*************** build_m_component_ref (tree datum, tree
*** 1298,1304 ****
ptrmem_type = TREE_TYPE (component);
if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
{
! error ("`%E' cannot be used as a member pointer, since it is of type `%T'",
component, ptrmem_type);
return error_mark_node;
}
--- 1300,1307 ----
ptrmem_type = TREE_TYPE (component);
if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
{
! error ("%qE cannot be used as a member pointer, since it is of "
! "type %qT",
component, ptrmem_type);
return error_mark_node;
}
*************** build_m_component_ref (tree datum, tree
*** 1306,1313 ****
objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
if (! IS_AGGR_TYPE (objtype))
{
! error ("cannot apply member pointer `%E' to `%E', which is of non-aggregate type `%T'",
! component, datum, objtype);
return error_mark_node;
}
--- 1309,1317 ----
objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
if (! IS_AGGR_TYPE (objtype))
{
! error ("cannot apply member pointer %qE to %qE, which is of "
! "non-aggregate type %qT",
! component, datum, objtype);
return error_mark_node;
}
*************** build_m_component_ref (tree datum, tree
*** 1327,1333 ****
if (!binfo)
{
mismatch:
! error ("pointer to member type `%T' incompatible with object type `%T'",
type, objtype);
return error_mark_node;
}
--- 1331,1338 ----
if (!binfo)
{
mismatch:
! error ("pointer to member type %qT incompatible with object "
! "type %qT",
type, objtype);
return error_mark_node;
}
*************** require_complete_eh_spec_types (tree fnt
*** 1549,1558 ****
{
if (decl)
error
! ("call to function `%D' which throws incomplete type `%#T'",
decl, type);
else
! error ("call to function which throws incomplete type `%#T'",
decl);
}
}
--- 1554,1563 ----
{
if (decl)
error
! ("call to function %qD which throws incomplete type %q#T",
decl, type);
else
! error ("call to function which throws incomplete type %q#T",
decl);
}
}
Index: testsuite/g++.dg/overload/pmf1.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/overload/pmf1.C,v
retrieving revision 1.1
diff -p -r1.1 pmf1.C
*** testsuite/g++.dg/overload/pmf1.C 11 Mar 2002 20:34:51 -0000 1.1
--- testsuite/g++.dg/overload/pmf1.C 10 Oct 2004 21:22:53 -0000
*************** void f (C) {} // even though thi
*** 17,21 ****
int main ()
{
! f (aip); // { dg-error "`A' is an inaccessible base of `B'" "" }
}
--- 17,21 ----
int main ()
{
! f (aip); // { dg-error "'A' is an inaccessible base of 'B'" "" }
}
Index: testsuite/g++.dg/template/qualttp20.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/template/qualttp20.C,v
retrieving revision 1.6
diff -p -r1.6 qualttp20.C
*** testsuite/g++.dg/template/qualttp20.C 2 Apr 2004 11:48:55 -0000 1.6
--- testsuite/g++.dg/template/qualttp20.C 10 Oct 2004 21:22:53 -0000
*************** struct AS
*** 15,22 ****
template <typename T> struct B1 : T
{
! typedef typename T::L __restrict__ r;// { dg-error "`__restrict__' qualifiers cannot" "" }
! typedef typename T::myT __restrict__ p;// { dg-warning "ignoring `__restrict__'" "" { xfail *-*-* } }
// The following are DR 295 dependent
typedef typename T::myT volatile *myvolatile;
--- 15,22 ----
template <typename T> struct B1 : T
{
! typedef typename T::L __restrict__ r;// { dg-error "'__restrict__' qualifiers cannot" "" }
! typedef typename T::myT __restrict__ p;// { dg-warning "ignoring '__restrict__'" "" { xfail *-*-* } }
// The following are DR 295 dependent
typedef typename T::myT volatile *myvolatile;
Index: testsuite/g++.dg/warn/incomplete1.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/warn/incomplete1.C,v
retrieving revision 1.2
diff -p -r1.2 incomplete1.C
*** testsuite/g++.dg/warn/incomplete1.C 5 Feb 2004 02:49:31 -0000 1.2
--- testsuite/g++.dg/warn/incomplete1.C 10 Oct 2004 21:22:53 -0000
***************
*** 9,17 ****
// (But the deletion does not constitute an ill-formed program. So the
// program should nevertheless compile, but it should give a warning.)
! class A; // { dg-warning "forward declaration of `struct A'" "" }
! A *a; // { dg-warning "`a' has incomplete type" "" }
int
main (int argc, char **argv)
--- 9,17 ----
// (But the deletion does not constitute an ill-formed program. So the
// program should nevertheless compile, but it should give a warning.)
! class A; // { dg-warning "forward declaration of 'struct A'" "" }
! A *a; // { dg-warning "'a' has incomplete type" "" }
int
main (int argc, char **argv)