public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3471: gcc 3.01 reports error about a private copy constructor that shouldn't get called.
@ 2001-06-28 22:16 ericp
  0 siblings, 0 replies; 4+ messages in thread
From: ericp @ 2001-06-28 22:16 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3471
>Category:       c++
>Synopsis:       gcc 3.01 reports error about a private copy constructor that shouldn't get called.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 28 22:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Eric Peterson
>Release:        gcc version 3.0.1 20010627 (prerelease)
>Organization:
>Environment:
debian linux 2.4.0 on i686
>Description:
gnu c++ compiler returns errors on the f.test and f.test2
calls claiming that the copy constructor needs to be
called but is private.  however, foo::foo(bar x)
should be the only constructor that needs to be called in
both cases.

I also confirmed that if you instead modify the foo class
to have a public copy constructor (no compiler error)
that it actually doesn't get called.  So this looks like a
bogus constructor namespace check (since the copy
constructor shouldn't and doesn't get called in the end
anyways).

error message:
$c++ privconstr.C
privconstr.C: In function `int main()':
privconstr.C:5: `foo::foo(const foo&)' is private
privconstr.C:20: within this context
privconstr.C:20:   initializing argument 1 of `void foo::test(const foo&)' from 
   result of `foo::foo(bar)'
privconstr.C:5: `foo::foo(const foo&)' is private
privconstr.C:21: within this context
privconstr.C:21:   initializing argument 1 of `void foo::test2(foo)' from 
   result of `foo::foo(bar)'
>How-To-Repeat:
run:
c++ privconstr.C
>Fix:
make private copy constructor declarations public but
don't define them so their use will at least trigger
a link error
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="privconstr.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="privconstr.C"

Y2xhc3MgYmFyIHsKfTsKCmNsYXNzIGZvbyB7ICAKICBmb28gKGNvbnN0IGZvbyAmZik7CgpwdWJs
aWM6CiAgCiAgZm9vIChiYXIgeCkge30KICBmb28gKCkge30KICAKICB2b2lkIHRlc3QgKGNvbnN0
IGZvbyAmZikge30KICB2b2lkIHRlc3QyIChmb28gZikge30KfTsKCmludCBtYWluICh2b2lkKSB7
CiAgZm9vIGY7CiAgYmFyIGI7CgogIGYudGVzdCAoYik7CiAgZi50ZXN0MiAoYik7CgogIHJldHVy
biAwOwp9Cg==


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

* Re: c++/3471: gcc 3.01 reports error about a private copy constructor that shouldn't get called.
@ 2001-11-21 23:16 mmitchel
  0 siblings, 0 replies; 4+ messages in thread
From: mmitchel @ 2001-11-21 23:16 UTC (permalink / raw)
  To: ericp, gcc-bugs, gcc-gnats, gcc-prs, gdr

Synopsis: gcc 3.01 reports error about a private copy constructor that shouldn't get called.

State-Changed-From-To: analyzed->closed
State-Changed-By: mmitchel
State-Changed-When: Thu Nov 29 12:19:41 2001
State-Changed-Why:
    Fixed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3471&database=gcc


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

* Re: c++/3471: gcc 3.01 reports error about a private copy constructor that shouldn't get called.
@ 2001-11-21 23:16 mmitchel
  0 siblings, 0 replies; 4+ messages in thread
From: mmitchel @ 2001-11-21 23:16 UTC (permalink / raw)
  To: gdr; +Cc: gcc-prs

The following reply was made to PR c++/3471; it has been noted by GNATS.

From: mmitchel@gcc.gnu.org
To: ericp@mit.edu, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
  gcc-prs@gcc.gnu.org, gdr@gcc.gnu.org
Cc:  
Subject: Re: c++/3471: gcc 3.01 reports error about a private copy constructor that shouldn't get called.
Date: 29 Nov 2001 20:19:41 -0000

 Synopsis: gcc 3.01 reports error about a private copy constructor that shouldn't get called.
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: mmitchel
 State-Changed-When: Thu Nov 29 12:19:41 2001
 State-Changed-Why:
     Fixed.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3471&database=gcc


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

* Re: c++/3471: gcc 3.01 reports error about a private copy constructor that shouldn't get called.
@ 2001-08-12  2:09 gdr
  0 siblings, 0 replies; 4+ messages in thread
From: gdr @ 2001-08-12  2:09 UTC (permalink / raw)
  To: ericp, gcc-bugs, gcc-prs, gdr, nobody

Synopsis: gcc 3.01 reports error about a private copy constructor that shouldn't get called.

Responsible-Changed-From-To: unassigned->gdr
Responsible-Changed-By: gdr
Responsible-Changed-When: Sun Aug 12 02:09:20 2001
Responsible-Changed-Why:
    See below.
State-Changed-From-To: open->analyzed
State-Changed-By: gdr
State-Changed-When: Sun Aug 12 02:09:20 2001
State-Changed-Why:
    The compiler is at fault on f.test (b).  But it is right on
    f.test2(b): Argument passing by value is copy-initialization
    and the copy-constructor needs to be accessible even if it is
    elided.
    
    -- Gaby

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3471&database=gcc


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

end of thread, other threads:[~2001-11-29 20:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-28 22:16 c++/3471: gcc 3.01 reports error about a private copy constructor that shouldn't get called ericp
2001-08-12  2:09 gdr
2001-11-21 23:16 mmitchel
2001-11-21 23:16 mmitchel

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).