public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14463] New: copy constructor access checked when passing reference arg
@ 2004-03-06 19:27 arnej at europe dot yahoo-inc dot com
  2004-03-06 19:31 ` [Bug c++/14463] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: arnej at europe dot yahoo-inc dot com @ 2004-03-06 19:27 UTC (permalink / raw)
  To: gcc-bugs

gcc 3.4 snapshots currently have problems compiling packages like
cppunit.  I just checked snapshot 3.4.0 20040303 (prerelease)
and this problem is still there.
Here's a simplified example of the problem, I hope this i helpful.

// test code

class TestFailure {
private:
  TestFailure(const TestFailure &);
public:
  TestFailure(int *p);
};

void dummy(const TestFailure &failure);

void usingfunc(int *intp) {
  // this:
  { TestFailure foo(intp);
    dummy(foo);
  }
  // should be the same as this
  dummy( TestFailure(intp) );
}

produces this error:

t.cpp: In function `void usingfunc(int*)':
t.cpp:5: error: `TestFailure::TestFailure(const TestFailure&)' is private
t.cpp:18: error: within this context

Full output from gcc -v -c t.cpp:

Reading specs from /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/specs
Configured with: ./configure --prefix=/snapshot
Thread model: posix
gcc version 3.4.0 20040303 (prerelease)
 /snapshot/libexec/gcc/i386-unknown-freebsd4.9/3.4.0/cc1plus -quiet -v t.cpp 
-quiet -dumpbase t.cpp -auxbase t -version -o /var/tmp//ccuJ8mOU.s
ignoring nonexistent directory "/snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.
0/../../../../i386-unknown-freebsd4.9/include"
#include "..." search starts here:
#include <...> search starts here:
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/../../../../include/c++/3.4.0
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/../../../../include/c++/3.4.
0/i386-unknown-freebsd4.9
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/../../../../include/c++/3.4.
0/backward
 /usr/local/include
 /snapshot/include
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/include
 /usr/include
End of search list.
GNU C++ version 3.4.0 20040303 (prerelease) (i386-unknown-freebsd4.9)
        compiled by GNU C version 2.95.4 20020320 [FreeBSD].
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=130534
t.cpp: In function `void usingfunc(int*)':
t.cpp:5: error: `TestFailure::TestFailure(const TestFailure&)' is private
t.cpp:18: error: within this context

-- 
           Summary: copy constructor access checked when passing reference
                    arg
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: arnej at europe dot yahoo-inc dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-freebsd4.9
  GCC host triplet: i386-unknown-freebsd4.9
GCC target triplet: i386-unknown-freebsd4.9


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


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

* [Bug c++/14463] [3.4/3.5 Regression] copy constructor access checked when passing reference arg
  2004-03-06 19:27 [Bug c++/14463] New: copy constructor access checked when passing reference arg arnej at europe dot yahoo-inc dot com
@ 2004-03-06 19:31 ` pinskia at gcc dot gnu dot org
  2004-03-07 15:16 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-06 19:31 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|copy constructor access     |[3.4/3.5 Regression] copy
                   |checked when passing        |constructor access checked
                   |reference arg               |when passing reference arg
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/14463] [3.4/3.5 Regression] copy constructor access checked when passing reference arg
  2004-03-06 19:27 [Bug c++/14463] New: copy constructor access checked when passing reference arg arnej at europe dot yahoo-inc dot com
  2004-03-06 19:31 ` [Bug c++/14463] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-03-07 15:16 ` giovannibajo at libero dot it
  2004-08-27  8:47 ` pinskia at gcc dot gnu dot org
  2004-08-27  8:48 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2004-03-07 15:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-03-07 15:16 -------
No: "TestFailure(intp)" is an rvalue ([basic.lval]/6, or [expr.type.conv]/1), 
and binding a rvalue to a reference requires the construction of a temporary 
([class.temporary]/1). When doing so, a copy constructor might be invoked. The 
standard (again at [class.temporary]/1) says that the copy can be elided, but 
the semantic restrictions (involving accessibility) must be satisfied. Hence 
GCC is correct here.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/14463] [3.4/3.5 Regression] copy constructor access checked when passing reference arg
  2004-03-06 19:27 [Bug c++/14463] New: copy constructor access checked when passing reference arg arnej at europe dot yahoo-inc dot com
  2004-03-06 19:31 ` [Bug c++/14463] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-03-07 15:16 ` giovannibajo at libero dot it
@ 2004-08-27  8:47 ` pinskia at gcc dot gnu dot org
  2004-08-27  8:48 ` 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:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-27 08:47 -------
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=14463


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

* [Bug c++/14463] [3.4/3.5 Regression] copy constructor access checked when passing reference arg
  2004-03-06 19:27 [Bug c++/14463] New: copy constructor access checked when passing reference arg arnej at europe dot yahoo-inc dot com
                   ` (2 preceding siblings ...)
  2004-08-27  8:47 ` pinskia at gcc dot gnu dot org
@ 2004-08-27  8:48 ` 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:48 UTC (permalink / raw)
  To: gcc-bugs


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

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


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


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-06 19:27 [Bug c++/14463] New: copy constructor access checked when passing reference arg arnej at europe dot yahoo-inc dot com
2004-03-06 19:31 ` [Bug c++/14463] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-03-07 15:16 ` giovannibajo at libero dot it
2004-08-27  8:47 ` pinskia at gcc dot gnu dot org
2004-08-27  8:48 ` 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).