This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/10245: [3.3/3.4 regression] ?: operator requires public copy constructor of return type


Old Synopsis: regression in 3.3, C++ ternary operator confuses type lookup
New Synopsis: [3.3/3.4 regression] ?: operator requires public copy constructor of return type

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Mar 27 17:22:47 2003
State-Changed-Why:
    Confirmed. This worked in 3.2, but doesn't anymore in 3.3 and
    3.4. Here's an extract:
    ----------------------------
    struct X {};
    
    struct Y {
        Y ();
        operator X () const;
      private:
        Y (const Y &);
    };
    
    void foo() {
      X x = (1 ? Y() : Y());
    }
    ------------------------
    
    g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
    x.cc: In function `void foo()':
    x.cc:7: error: `Y::Y(const Y&)' is private
    x.cc:12: error: within this context
    x.cc:7: error: `Y::Y(const Y&)' is private
    x.cc:12: error: within this context
    
    Apparently it wants to make a copy of the return arguments.
    Since at least in Standard C++ (not in Gnu C++) ?: returns
    an rvalue, I don't think this is necessary.
    
    W.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]