summaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-08 21:31:59 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-08 21:31:59 +0000
commit3a3fc4a767e01feadf5f43e9b6ffc47d10b7dcbf (patch)
tree29a4c9dc0259d5b83217d2467644b8e8c180be4d /gcc/cp/lambda.c
parenta2ebcb84e82e4bfb9893737eedb4a1bf8507cf96 (diff)
downloadgcc-3a3fc4a767e01feadf5f43e9b6ffc47d10b7dcbf.tar.gz
* lambda.c (maybe_add_lambda_conv_op): Fix null object argument.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238180 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 85ad9f895d4..3822882acca 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -904,6 +904,8 @@ maybe_add_lambda_conv_op (tree type)
tree optype = TREE_TYPE (callop);
tree fn_result = TREE_TYPE (optype);
+ tree thisarg = build_nop (TREE_TYPE (DECL_ARGUMENTS (callop)),
+ null_pointer_node);
if (generic_lambda_p)
{
/* Prepare the dependent member call for the static member function
@@ -911,7 +913,8 @@ maybe_add_lambda_conv_op (tree type)
return expression for a deduced return call op to allow for simple
implementation of the conversion operator. */
- tree instance = build_nop (type, null_pointer_node);
+ tree instance = cp_build_indirect_ref (thisarg, RO_NULL,
+ tf_warning_or_error);
tree objfn = build_min (COMPONENT_REF, NULL_TREE,
instance, DECL_NAME (callop), NULL_TREE);
int nargs = list_length (DECL_ARGUMENTS (callop)) - 1;
@@ -923,9 +926,7 @@ maybe_add_lambda_conv_op (tree type)
else
{
direct_argvec = make_tree_vector ();
- direct_argvec->quick_push (build1 (NOP_EXPR,
- TREE_TYPE (DECL_ARGUMENTS (callop)),
- null_pointer_node));
+ direct_argvec->quick_push (thisarg);
}
/* Copy CALLOP's argument list (as per 'copy_list') as FN_ARGS in order to