Commit ab8ffc79 by Mark Mitchell Committed by Mark Mitchell

re PR c++/13478 (gcc uses wrong constructor to initialize a const reference)

	PR c++/13478
	* call.c (convert_like_real): Do not perform an additional
	direct-initialization when binding to a reference.

	PR c++/13478
	* g++.dg/init/ref10.C: New test.

From-SVN: r75979
parent 16201823
2004-01-16 Mark Mitchell <mark@codesourcery.com>
PR c++/13478
* call.c (convert_like_real): Do not perform an additional
direct-initialization when binding to a reference.
2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org> 2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/13407 PR c++/13407
......
...@@ -4068,8 +4068,7 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner, ...@@ -4068,8 +4068,7 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
conversion, but is not considered during overload resolution. conversion, but is not considered during overload resolution.
If the target is a class, that means call a ctor. */ If the target is a class, that means call a ctor. */
if (IS_AGGR_TYPE (totype) if (IS_AGGR_TYPE (totype) && inner >= 0)
&& (inner >= 0 || !lvalue_p (expr)))
{ {
expr = (build_temp expr = (build_temp
(expr, totype, (expr, totype,
......
2004-01-16 Mark Mitchell <mark@codesourcery.com>
PR c++/13478
* g++.dg/init/ref10.C: New test.
2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org> 2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/13407 PR c++/13407
......
// PR c++/13478
struct A {};
struct B : protected A {
B() {};
B(const A& ) {};
private:
B(const B& ) {};
};
void foo(const A* ap)
{
const B& br = *ap;
}
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