public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17938] cannot assign result to const reference if copy ctor is not accessible
  2004-10-11 17:47 [Bug c++/17938] New: cannot assign result to const reference if copy ctor is not accessible bryner at brianryner dot com
@ 2004-10-11 17:47 ` bryner at brianryner dot com
  2004-10-11 17:57 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bryner at brianryner dot com @ 2004-10-11 17:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid


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


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

* [Bug c++/17938] New: cannot assign result to const reference if copy ctor is not accessible
@ 2004-10-11 17:47 bryner at brianryner dot com
  2004-10-11 17:47 ` [Bug c++/17938] " bryner at brianryner dot com
  2004-10-11 17:57 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: bryner at brianryner dot com @ 2004-10-11 17:47 UTC (permalink / raw)
  To: gcc-bugs

This code fails to compile on current mainline:

-------------
class A
{
  A(const A&);
};
 
const A GetA();
 
void caller()
{
  const A& a = GetA();
}
-----------------------------

with this error:

access-const-ref.cpp: In function `void caller()':
access-const-ref.cpp:3: error: 'A::A(const A&)' is private
access-const-ref.cpp:10: error: within this context

It compiles fine on gcc 3.3.3.  compiler version:

$ gcc -v
Reading specs from /usr/gcc4/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/usr/gcc4 --enable-shared
--enable-threads=posix --enable-checking=release --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions --disable-libgcj
--enable-languages=c,c++
Thread model: posix
gcc version 4.0.0 20041011 (experimental)

-- 
           Summary: cannot assign result to const reference if copy ctor is
                    not accessible
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bryner at brianryner dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug c++/17938] cannot assign result to const reference if copy ctor is not accessible
  2004-10-11 17:47 [Bug c++/17938] New: cannot assign result to const reference if copy ctor is not accessible bryner at brianryner dot com
  2004-10-11 17:47 ` [Bug c++/17938] " bryner at brianryner dot com
@ 2004-10-11 17:57 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-11 17:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-11 17:57 -------
Please consult http://gcc.gnu.org/bugs.html#cxx_rvalbind.

There are other reports of the same bug.

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

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


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


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

end of thread, other threads:[~2004-10-11 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 17:47 [Bug c++/17938] New: cannot assign result to const reference if copy ctor is not accessible bryner at brianryner dot com
2004-10-11 17:47 ` [Bug c++/17938] " bryner at brianryner dot com
2004-10-11 17:57 ` 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).