[Bug c++/23316] Unused copy constructor can't be private

2005-08-10 Thread giovannibajo at libero dot it

--- Additional Comments From giovannibajo at libero dot it  2005-08-10 
13:52 ---
Please read:
http://gcc.gnu.org/gcc-3.4/changes.html


-- 
   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23316


[Bug c++/23316] Unused copy constructor can't be private

2005-08-10 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-10 
13:53 ---
Please 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
}

-

This is invalid and is rejected as expected.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23316


[Bug c++/23316] Unused copy constructor can't be private

2005-08-10 Thread christian dot engstrom at glindra dot se

--- Additional Comments From christian dot engstrom at glindra dot se  
2005-08-10 14:41 ---
Subject: Re:  Unused copy constructor can't be private

giovannibajo at libero dot it wrote:

 Please read:
 http://gcc.gnu.org/gcc-3.4/changes.html

Quite right. That was indeed a surprising rule.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23316