public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16145] New: Complaint about private copy constructor
@ 2004-06-22 20:11 apl at alum dot mit dot edu
  2004-06-22 20:12 ` [Bug c++/16145] " apl at alum dot mit dot edu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: apl at alum dot mit dot edu @ 2004-06-22 20:11 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/16145] Complaint about private copy constructor
  2004-06-22 20:11 [Bug c++/16145] New: Complaint about private copy constructor apl at alum dot mit dot edu
@ 2004-06-22 20:12 ` apl at alum dot mit dot edu
  2004-06-22 20:29 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: apl at alum dot mit dot edu @ 2004-06-22 20:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From apl at alum dot mit dot edu  2004-06-22 20:12 -------
Created an attachment (id=6607)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6607&action=view)
Simple test of private copy constructor

compile with -DTESTER to demonstrate that copy constructor is never called

compile without any flags to see private copy constructor warning message.

-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/16145] Complaint about private copy constructor
  2004-06-22 20:11 [Bug c++/16145] New: Complaint about private copy constructor apl at alum dot mit dot edu
  2004-06-22 20:12 ` [Bug c++/16145] " apl at alum dot mit dot edu
@ 2004-06-22 20:29 ` bangerth at dealii dot org
  2004-08-27  8:50 ` pinskia at gcc dot gnu dot org
  2004-08-27  8:51 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2004-06-22 20:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-22 20:29 -------
That's what the language requires. See the release notes of gcc 3.4.0. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/16145] Complaint about private copy constructor
  2004-06-22 20:11 [Bug c++/16145] New: Complaint about private copy constructor apl at alum dot mit dot edu
  2004-06-22 20:12 ` [Bug c++/16145] " apl at alum dot mit dot edu
  2004-06-22 20:29 ` bangerth at dealii dot org
@ 2004-08-27  8:50 ` pinskia at gcc dot gnu dot org
  2004-08-27  8:51 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-27  8:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-27 08:50 -------
bug 12226.

*** This bug has been marked as a duplicate of 12226 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/16145] Complaint about private copy constructor
  2004-06-22 20:11 [Bug c++/16145] New: Complaint about private copy constructor apl at alum dot mit dot edu
                   ` (2 preceding siblings ...)
  2004-08-27  8:50 ` pinskia at gcc dot gnu dot org
@ 2004-08-27  8:51 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-27  8:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-27 08:50 -------
Reopening to mark as a dup of ...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-08-27  8:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-22 20:11 [Bug c++/16145] New: Complaint about private copy constructor apl at alum dot mit dot edu
2004-06-22 20:12 ` [Bug c++/16145] " apl at alum dot mit dot edu
2004-06-22 20:29 ` bangerth at dealii dot org
2004-08-27  8:50 ` pinskia at gcc dot gnu dot org
2004-08-27  8:51 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).