summaryrefslogtreecommitdiffstats
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-24 03:50:31 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-24 03:50:31 +0000
commit7873fcd66afba8cb976f4a8d438c39af1dcd592e (patch)
treeaef78361996e61e02ee5a14c7f9d6f1ab2a35d52 /gcc/cp/method.c
parent8de62358358a2a0e0e40bc0813aecba662fa5a6e (diff)
downloadppe42-gcc-7873fcd66afba8cb976f4a8d438c39af1dcd592e.tar.gz
ppe42-gcc-7873fcd66afba8cb976f4a8d438c39af1dcd592e.zip
PR c++/26912
* cp-tree.h (build_this_parm): Declare. (grok_method_quals): Remove. (build_memfn_type): Declare. (build_artificial_parm): Declare. (do_friend): Remove quals parameter. * decl.c (build_this_parm): New function. (grokfndecl): Use it. Do not pass quals to grokclassfn. (grokdeclarator): Rename quals to memfn_quals. Avoid allocating unnecessary TYPE_DECLs. Correct qualification of member function types. Tidy. * method.c (implicitly_declare_fn): Use build_this_parm. * friend.c (do_friend): Remove quals parameter. * decl2.c (grok_method_quals): Remove. (build_memfn_type): New function. (build_artificial_parm): Give it external linkage. (grokclassfn): Remove quals parameter. Do not build "this" PARM_DECL here. PR c++/26912 * g++.dg/template/friend41.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113213 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index d2bee99dc5e..68ec8ab4181 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -978,6 +978,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
tree fn_type;
tree raises = empty_except_spec;
tree rhs_parm_type = NULL_TREE;
+ tree this_parm;
tree name;
HOST_WIDE_INT saved_processing_template_decl;
@@ -1067,8 +1068,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
DECL_ASSIGNMENT_OPERATOR_P (fn) = 1;
SET_OVERLOADED_OPERATOR_CODE (fn, NOP_EXPR);
}
- /* Create the argument list. The call to "grokclassfn" will add the
- "this" parameter and any other implicit parameters. */
+ /* Create the explicit arguments. */
if (rhs_parm_type)
{
/* Note that this parameter is *not* marked DECL_ARTIFICIAL; we
@@ -1077,9 +1077,12 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p)
DECL_ARGUMENTS (fn) = cp_build_parm_decl (NULL_TREE, rhs_parm_type);
TREE_READONLY (DECL_ARGUMENTS (fn)) = 1;
}
+ /* Add the "this" parameter. */
+ this_parm = build_this_parm (fn_type, TYPE_UNQUALIFIED);
+ TREE_CHAIN (this_parm) = DECL_ARGUMENTS (fn);
+ DECL_ARGUMENTS (fn) = this_parm;
- grokclassfn (type, fn, kind == sfk_destructor ? DTOR_FLAG : NO_SPECIAL,
- TYPE_UNQUALIFIED);
+ grokclassfn (type, fn, kind == sfk_destructor ? DTOR_FLAG : NO_SPECIAL);
grok_special_member_properties (fn);
set_linkage_according_to_type (type, fn);
rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
OpenPOWER on IntegriCloud