This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16145] New: Complaint about private copy constructor


Prior to 3.4, a private copy constructor works just fine.  In 3.4.1, it seems
that a simple example as below will fail with a message:

gccbug.cxx: In function `int main()':
gccbug.cxx:17: error: `Simple::Simple(const Simple&)' is private
gccbug.cxx:32: error: within this context

 
class Simple {
public:
  Simple (int i) : m_i (i) {} 
  int m_i;
private:
  Simple (const Simple&);       // hide this
};

std::ostream & operator<< (std::ostream & f, const Simple & s)
{
  f << s.m_i;

  return f;
}


I have a variation on this test that has a public copy constructor that asserts
if it's called.  The test program never calls the copy constructor.

Is this a change in the language or a bug?

-- 
           Summary: Complaint about private copy constructor
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: apl at alum dot mit dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]