* semantics.c (maybe_add_lambda_conv_op): Make non-static.
Also add the thunk function returned by the conversion op.
Mark the conversion deleted if the op() is variadic.
* decl2.c (mark_used): Give helpful message about deleted conversion.
* parser.c (cp_parser_lambda_declarator_opt): Don't make op() static.
* semantics.c (finish_this_expr): Adjust.
* mangle.c (write_closure_type_name): Adjust.
* decl.c (grok_op_properties): Don't allow it.
* call.c (build_user_type_conversion_1): No static conversion ops.
(build_op_call): Or op().
* decl2.c (change_return_type): Fix 'this' quals.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157681
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-03-23 Jason Merrill <jason@redhat.com>
+
+ Make lambda conversion op and op() non-static.
+ * semantics.c (maybe_add_lambda_conv_op): Make non-static.
+ Also add the thunk function returned by the conversion op.
+ Mark the conversion deleted if the op() is variadic.
+ * decl2.c (mark_used): Give helpful message about deleted conversion.
+ * parser.c (cp_parser_lambda_declarator_opt): Don't make op() static.
+ * semantics.c (finish_this_expr): Adjust.
+ * mangle.c (write_closure_type_name): Adjust.
+ * decl.c (grok_op_properties): Don't allow it.
+ * call.c (build_user_type_conversion_1): No static conversion ops.
+ (build_op_call): Or op().
+
+ * decl2.c (change_return_type): Fix 'this' quals.
+
2010-03-22 Jason Merrill <jason@redhat.com>
PR c++/43333
for (cand = candidates; cand != old_candidates; cand = cand->next)
{
- conversion *ics
- = implicit_conversion (totype,
- TREE_TYPE (TREE_TYPE (cand->fn)),
- 0,
- /*c_cast_p=*/false, convflags);
+ tree fn = OVL_CURRENT (fns);
+
+ if (DECL_NONCONVERTING_P (fn)
+ && (flags & LOOKUP_ONLYCONVERTING))
+ continue;
+
+ /* [over.match.funcs] For conversion functions, the function
+ is considered to be a member of the class of the implicit
+ object argument for the purpose of defining the type of
+ the implicit object parameter.
+
+ So we pass fromtype as CTYPE to add_*_candidate. */
+
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ cand = add_template_candidate (&candidates, fn, fromtype,
+ NULL_TREE,
+ first_arg, NULL, totype,
+ TYPE_BINFO (fromtype),
+ conversion_path,
+ flags,
+ DEDUCE_CONV);
+ else
+ cand = add_function_candidate (&candidates, fn, fromtype,
+ first_arg, NULL,
+ TYPE_BINFO (fromtype),
+ conversion_path,
+ flags);
/* If LOOKUP_NO_TEMP_BIND isn't set, then this is
copy-initialization. In that case, "The result of the
{
first_mem_arg = build_this (obj);
- add_candidates (BASELINK_FUNCTIONS (fns),
- first_mem_arg, *args, NULL_TREE,
- NULL_TREE, false,
- BASELINK_BINFO (fns), BASELINK_ACCESS_BINFO (fns),
- LOOKUP_NORMAL, &candidates);
+ for (fns = BASELINK_FUNCTIONS (fns); fns; fns = OVL_NEXT (fns))
+ {
+ tree fn = OVL_CURRENT (fns);
+
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ add_template_candidate (&candidates, fn, base, NULL_TREE,
+ first_mem_arg, *args, NULL_TREE,
+ TYPE_BINFO (type),
+ TYPE_BINFO (type),
+ LOOKUP_NORMAL, DEDUCE_CALL);
+ else
+ add_function_candidate
+ (&candidates, fn, base, first_mem_arg, *args, TYPE_BINFO (type),
+ TYPE_BINFO (type), LOOKUP_NORMAL);
+ }
}
convs = lookup_conversions (type, /*lookup_template_convs_p=*/true);
body = begin_function_body ();
compound_stmt = begin_compound_stmt (0);
- arg = build1 (NOP_EXPR, TREE_TYPE (DECL_ARGUMENTS (callop)),
- null_pointer_node);
+ arg = build1 (NOP_EXPR, TREE_TYPE (DECL_ARGUMENTS (callop)), void_zero_node);
argvec = make_tree_vector ();
VEC_quick_push (tree, argvec, arg);
for (arg = DECL_ARGUMENTS (statfn); arg; arg = TREE_CHAIN (arg))
VEC_safe_push (tree, gc, argvec, arg);
- call = build_call_a (callop, VEC_length (tree, argvec),
- VEC_address (tree, argvec));
+ call = build_cxx_call (callop, VEC_length (tree, argvec),
+ VEC_address (tree, argvec));
CALL_FROM_THUNK_P (call) = 1;
- if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call)))
- call = build_cplus_new (TREE_TYPE (call), call);
- call = convert_from_reference (call);
finish_return_stmt (call);
finish_compound_stmt (compound_stmt);
start_preparsed_function (convfn, NULL_TREE,
SF_PRE_PARSED | SF_INCLASS_INLINE);
+ if (DECL_ONE_ONLY (statfn))
+ {
+ /* Put the thunk in the same comdat group as the call op. */
+ struct cgraph_node *callop_node, *thunk_node;
+ DECL_COMDAT_GROUP (statfn) = DECL_COMDAT_GROUP (callop);
+ callop_node = cgraph_node (callop);
+ thunk_node = cgraph_node (statfn);
+ gcc_assert (callop_node->same_comdat_group == NULL);
+ gcc_assert (thunk_node->same_comdat_group == NULL);
+ callop_node->same_comdat_group = thunk_node;
+ thunk_node->same_comdat_group = callop_node;
+ }
body = begin_function_body ();
compound_stmt = begin_compound_stmt (0);
+2010-03-23 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/lambda/lambda-const-neg.C: Adjust for non-static op().
+ * g++.dg/cpp0x/lambda/lambda-conv.C: Likewise.
+ * g++.dg/cpp0x/lambda/lambda-mangle.C: Likewise.
+ * g++.dg/cpp0x/lambda/lambda-non-const.C: Likewise.
+ * g++.dg/cpp0x/lambda/lambda-conv2.C: New.
+ * g++.dg/cpp0x/lambda/lambda-conv3.C: New.
+
2010-03-23 Mike Stump <mikestump@comcast.net>
PR target/33120