mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-11 03:59:44 +08:00
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
This commit is contained in:
parent
1620182354
commit
ab8ffc795c
@ -1,3 +1,9 @@
|
||||
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>
|
||||
|
||||
PR c++/13407
|
||||
|
@ -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.
|
||||
|
||||
If the target is a class, that means call a ctor. */
|
||||
if (IS_AGGR_TYPE (totype)
|
||||
&& (inner >= 0 || !lvalue_p (expr)))
|
||||
if (IS_AGGR_TYPE (totype) && inner >= 0)
|
||||
{
|
||||
expr = (build_temp
|
||||
(expr, totype,
|
||||
|
@ -1,3 +1,8 @@
|
||||
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>
|
||||
|
||||
PR c++/13407
|
||||
|
14
gcc/testsuite/g++.dg/init/ref10.C
Normal file
14
gcc/testsuite/g++.dg/init/ref10.C
Normal file
@ -0,0 +1,14 @@
|
||||
// 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user