From: paolo Date: Fri, 10 Jul 2015 22:56:35 +0000 (+0000) Subject: /cp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b6b9f80dc6ac3082de72ba7219b68a029901fa7;p=thirdparty%2Fgcc.git /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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225705 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 130e35863fca..9d9e0c145c69 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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. + 2015-07-10 Jason Merrill * pt.c (find_parameter_packs_r): Handle variable templates. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4da1072bf3db..07d6f0e00eaa 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 44d391b8ba10..dde2803688eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-10 Paolo Carlini + + PR c++/54521 + * g++.dg/init/explicit3.C: New. + 2015-07-10 H.J. Lu PR target/66819 diff --git a/gcc/testsuite/g++.dg/init/explicit3.C b/gcc/testsuite/g++.dg/init/explicit3.C new file mode 100644 index 000000000000..c5d4e0d0ff06 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/explicit3.C @@ -0,0 +1,12 @@ +// PR c++/54521 + +struct X +{ + X(int) {} + explicit X(X const &) {} +}; + +int main() +{ + X x = 1; +}