aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-02-02 16:53:17 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-02-02 16:53:17 +0000
commite9525111c9a3fabe2244b57e7a6257b708b8f9f5 (patch)
tree18f97563be8180b80b8d845bab5a84a1cb6453c4 /gcc/cp/init.c
parent7c9201514989cce06b05850f55f3bcd0e3d5e18b (diff)
downloadgcc-e9525111c9a3fabe2244b57e7a6257b708b8f9f5.zip
gcc-e9525111c9a3fabe2244b57e7a6257b708b8f9f5.tar.gz
gcc-e9525111c9a3fabe2244b57e7a6257b708b8f9f5.tar.bz2
re PR c++/13113 (Nice warning about &(X::m) lost)
PR c++/13113 * init.c (build_offset_ref): Improve error recovery for invalid uses of non-static member functions. PR c++/13854 * cp-tree.h (cp_build_type_attribute_variant): New function. * class.c (build_clone): Use cp_build_type_attribute_variant. * decl.c (duplicate_decls): Likewise. * pt.c (copy_default_args_to_explicit_spec): Likewise. (tsubst_function_type): Likewise. * tree.c (build_exception_variant): Check attributes before concluding that two types are the same. (cp_build_type-attribute_variant): New method. * typeck.c (merge_types): Use cp_build_type_attribute_variant. PR c++/13907 * call.c (convert_class_to_reference): Keep better track of pedantically invalid user-defined conversions. PR c++/13113 * g++.old-deja/g++.mike/net36.C: Adjust error messages. PR c++/13854 * g++.dg/ext/attrib13.C: New test. PR c++/13907 * g++.dg/conversion/op2.C: New test. From-SVN: r77127
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 6f361b0..2c89996 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1559,16 +1559,20 @@ build_offset_ref (tree type, tree name, bool address_p)
a class derived from that class (_class.base.init_). */
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (member))
{
+ /* Build a representation of a the qualified name suitable
+ for use as the operand to "&" -- even though the "&" is
+ not actually present. */
+ member = build (OFFSET_REF, TREE_TYPE (member), decl, member);
/* In Microsoft mode, treat a non-static member function as if
it were a pointer-to-member. */
if (flag_ms_extensions)
{
- member = build (OFFSET_REF, TREE_TYPE (member), decl, member);
PTRMEM_OK_P (member) = 1;
return build_unary_op (ADDR_EXPR, member, 0);
}
- error ("invalid use of non-static member function `%D'", member);
- return error_mark_node;
+ error ("invalid use of non-static member function `%D'",
+ TREE_OPERAND (member, 1));
+ return member;
}
else if (TREE_CODE (member) == FIELD_DECL)
{