From 0a73242e1ab3ac00d8fe9a98f10732473a96dc04 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 10 Jul 2015 22:56:35 +0000 Subject: re PR c++/54521 (g++ fails to call explicit constructors in the second step of copy initialization) /cp 2015-07-10 Paolo Carlini PR c++/54521 * call.c (convert_like_real): Do not set LOOKUP_ONLYCONVERTING for the second step of copy-initialization. /testsuite 2015-07-10 Paolo Carlini PR c++/54521 * g++.dg/init/explicit3.C: New. From-SVN: r225705 --- gcc/cp/call.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/cp/call.c') diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4da1072..07d6f0e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6437,12 +6437,14 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, /* Copy-initialization where the cv-unqualified version of the source type is the same class as, or a derived class of, the class of the destination [is treated as direct-initialization]. [dcl.init] */ - flags = LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING; + flags = LOOKUP_NORMAL; if (convs->user_conv_p) /* This conversion is being done in the context of a user-defined conversion (i.e. the second step of copy-initialization), so don't allow any more. */ flags |= LOOKUP_NO_CONVERSION; + else + flags |= LOOKUP_ONLYCONVERTING; if (convs->rvaluedness_matches_p) flags |= LOOKUP_PREFER_RVALUE; if (TREE_CODE (expr) == TARGET_EXPR -- cgit v1.1