public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17184] New: Unexpected copy constructor call
@ 2004-08-25 14:13 bill at classdesign dot com
  2004-08-25 14:47 ` [Bug c++/17184] " pinskia at gcc dot gnu dot org
  2004-08-25 14:50 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: bill at classdesign dot com @ 2004-08-25 14:13 UTC (permalink / raw)
  To: gcc-bugs

Following code should compile:

class X
{
   public:
          X()
          {
          }
   private:
          X( const X& );
          X& operator=( const X& );
};

void f( const X& )
{
}

int
main()
{
   f( X() );
   return 0;
}

-- 
           Summary: Unexpected copy constructor call
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bill at classdesign dot com
                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=17184


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

* [Bug c++/17184] Unexpected copy constructor call
  2004-08-25 14:13 [Bug c++/17184] New: Unexpected copy constructor call bill at classdesign dot com
@ 2004-08-25 14:47 ` pinskia at gcc dot gnu dot org
  2004-08-25 14:50 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-25 14:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-25 14:47 -------
*** Bug 17185 has been marked as a duplicate of this bug. ***

-- 


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


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

* [Bug c++/17184] Unexpected copy constructor call
  2004-08-25 14:13 [Bug c++/17184] New: Unexpected copy constructor call bill at classdesign dot com
  2004-08-25 14:47 ` [Bug c++/17184] " pinskia at gcc dot gnu dot org
@ 2004-08-25 14:50 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-25 14:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-25 14:50 -------
Read <http://gcc.gnu.org/gcc-3.4/changes.html>:
When binding an rvalue of class type to a reference, the copy constructor of the class must be 
accessible. For instance, consider the following code:
        class A 
        {
        public:
          A();
          
        private:
          A(const A&);   // private copy ctor
        };
        
        A makeA(void);
        void foo(const A&);
        
        void bar(void)
        {
          foo(A());       // error, copy ctor is not accessible
          foo(makeA());   // error, copy ctor is not accessible
          
          A a1;
          foo(a1);        // OK, a1 is a lvalue
        }

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


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


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-25 14:13 [Bug c++/17184] New: Unexpected copy constructor call bill at classdesign dot com
2004-08-25 14:47 ` [Bug c++/17184] " pinskia at gcc dot gnu dot org
2004-08-25 14:50 ` 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).