mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/54521 (g++ fails to call explicit constructors in the second step of copy initialization)
/cp 2015-07-10 Paolo Carlini <paolo.carlini@oracle.com> 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 <paolo.carlini@oracle.com> PR c++/54521 * g++.dg/init/explicit3.C: New. From-SVN: r225705
This commit is contained in:
parent
2ec7e902e7
commit
0a73242e1a
|
|
@ -1,3 +1,9 @@
|
||||||
|
2015-07-10 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
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 <jason@redhat.com>
|
2015-07-10 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
* pt.c (find_parameter_packs_r): Handle variable templates.
|
* pt.c (find_parameter_packs_r): Handle variable templates.
|
||||||
|
|
|
||||||
|
|
@ -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
|
/* 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
|
type is the same class as, or a derived class of, the class of the
|
||||||
destination [is treated as direct-initialization]. [dcl.init] */
|
destination [is treated as direct-initialization]. [dcl.init] */
|
||||||
flags = LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING;
|
flags = LOOKUP_NORMAL;
|
||||||
if (convs->user_conv_p)
|
if (convs->user_conv_p)
|
||||||
/* This conversion is being done in the context of a user-defined
|
/* This conversion is being done in the context of a user-defined
|
||||||
conversion (i.e. the second step of copy-initialization), so
|
conversion (i.e. the second step of copy-initialization), so
|
||||||
don't allow any more. */
|
don't allow any more. */
|
||||||
flags |= LOOKUP_NO_CONVERSION;
|
flags |= LOOKUP_NO_CONVERSION;
|
||||||
|
else
|
||||||
|
flags |= LOOKUP_ONLYCONVERTING;
|
||||||
if (convs->rvaluedness_matches_p)
|
if (convs->rvaluedness_matches_p)
|
||||||
flags |= LOOKUP_PREFER_RVALUE;
|
flags |= LOOKUP_PREFER_RVALUE;
|
||||||
if (TREE_CODE (expr) == TARGET_EXPR
|
if (TREE_CODE (expr) == TARGET_EXPR
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2015-07-10 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR c++/54521
|
||||||
|
* g++.dg/init/explicit3.C: New.
|
||||||
|
|
||||||
2015-07-10 H.J. Lu <hongjiu.lu@intel.com>
|
2015-07-10 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR target/66819
|
PR target/66819
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// PR c++/54521
|
||||||
|
|
||||||
|
struct X
|
||||||
|
{
|
||||||
|
X(int) {}
|
||||||
|
explicit X(X const &) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
X x = 1;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue