aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-08 02:08:04 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-08 02:08:04 -0400
commitc9b558895e7c82d5973c8682c766dedb95bb4d32 (patch)
tree2e35359ed4fd250784d185eb52b05a3983587bd6 /gcc
parent6ae81785e54e593a369b9e0b92594f6ff474bc83 (diff)
downloadgcc-c9b558895e7c82d5973c8682c766dedb95bb4d32.zip
gcc-c9b558895e7c82d5973c8682c766dedb95bb4d32.tar.gz
gcc-c9b558895e7c82d5973c8682c766dedb95bb4d32.tar.bz2
re PR c++/48481 (C++ overloading memory hog)
PR c++/48481 * call.c (build_user_type_conversion_1): Use lookup_fnfields_slot. Release unused vector. From-SVN: r172162
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fcb5232..2cb394f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2011-04-07 Jason Merrill <jason@redhat.com>
+ PR c++/48481
+ * call.c (build_user_type_conversion_1): Use lookup_fnfields_slot.
+ Release unused vector.
+
PR c++/48451
* pt.c (fn_type_unification): Don't clear incomplete pack flag.
(type_unification_real): Clear it here instead.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index f283bd1..096fbbc 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3249,7 +3249,9 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
|| !DERIVED_FROM_P (totype, fromtype));
if (MAYBE_CLASS_TYPE_P (totype))
- ctors = lookup_fnfields (totype, complete_ctor_identifier, 0);
+ /* Use lookup_fnfields_slot instead of lookup_fnfields to avoid
+ creating a garbage BASELINK; constructors can't be inherited. */
+ ctors = lookup_fnfields_slot (totype, complete_ctor_identifier);
if (MAYBE_CLASS_TYPE_P (fromtype))
{
@@ -3281,7 +3283,6 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
if (ctors)
{
int ctorflags = flags;
- ctors = BASELINK_FUNCTIONS (ctors);
first_arg = build_int_cst (build_pointer_type (totype), 0);
@@ -3389,7 +3390,11 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
candidates = splice_viable (candidates, pedantic, &any_viable_p);
if (!any_viable_p)
- return NULL;
+ {
+ if (args)
+ release_tree_vector (args);
+ return NULL;
+ }
cand = tourney (candidates);
if (cand == 0)