Commit 78dd7466 by Jason Merrill Committed by Jason Merrill

Core issue 899

	Core issue 899
	* call.c (add_function_candidate): Only permit explicit conversion
	ops if copy ctor was called with a single argument.

From-SVN: r153509
parent fc77a3d8
2009-10-23 Jason Merrill <jason@redhat.com>
Core issue 899
* call.c (add_function_candidate): Only permit explicit conversion
ops if copy ctor was called with a single argument.
* call.c (initialize_reference): Tweak error message.
2009-10-21 Jakub Jelinek <jakub@redhat.com>
......
......@@ -1631,7 +1631,8 @@ add_function_candidate (struct z_candidate **candidates,
parmtype = build_pointer_type (parmtype);
}
if (ctype && i == 0 && DECL_COPY_CONSTRUCTOR_P (fn))
if (ctype && i == 0 && DECL_COPY_CONSTRUCTOR_P (fn)
&& (len-skip == 1))
{
/* Hack: Direct-initialize copy parm (i.e. suppress
LOOKUP_ONLYCONVERTING) to make explicit conversion ops
......
2009-10-23 Jason Merrill <jason@redhat.com>
Core issue 899
* g++.dg/cpp0x/explicit4.C: New.
2009-10-23 Joseph Myers <joseph@codesourcery.com>
* g++.dg/abi/rtti3.C, g++.dg/abi/thunk4.C: Skip for *-*-mingw* and
......
// Negative explicit conv test.
// { dg-options "-std=c++0x" }
struct A {
A(const A&, int = 0); // { dg-message "candidates" }
};
struct B
{
explicit operator A();
};
int main()
{
B b;
(A(b)); // OK
(A(b,1)); // { dg-error "no match" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment