[Bug c++/17184] Unexpected copy constructor call
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Aug 25 14:50:00 GMT 2004
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-25 14:50 -------
Read <http://gcc.gnu.org/gcc-3.4/changes.html>:
When binding an rvalue of class type to a reference, the copy constructor of the class must be
accessible. For instance, consider the following code:
class A
{
public:
A();
private:
A(const A&); // private copy ctor
};
A makeA(void);
void foo(const A&);
void bar(void)
{
foo(A()); // error, copy ctor is not accessible
foo(makeA()); // error, copy ctor is not accessible
A a1;
foo(a1); // OK, a1 is a lvalue
}
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17184
More information about the Gcc-bugs
mailing list