This is the mail archive of the gcc-prs@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++/9748: c++ using "operator = ( const Foo& )" when it *should* use "operator = ( int )"


Synopsis: c++ using "operator = ( const Foo& )" when it *should* use "operator = ( int )"

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Tue Feb 18 20:27:53 2003
State-Changed-Why:
    Not a bug.
    
    If you use the assignment for 
      Foo foo = 1;
    then a conversion constructor and a copy constructor needs
    to be accessible (the compiler is allowed to elide the
    temporary, though).
    
    In strict ISO mode, Intel's icc also agrees:
    tmp/g> icc -Xc -ansi x.cc
    x.cc(36): warning #734: "Foo::Foo(const Foo &)", required for copy that was eliminated, is inaccessible
              Foo foo = returnsInt();
                        ^
    
    What you quote about temporaries has nothing to do with
    this.
    
    W.

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


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