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++/8631: bug in typecasting the return value of a function


Synopsis: bug in typecasting the return value of a function

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Tue Nov 19 07:01:18 2002
State-Changed-Why:
    User error. You are trying nonsense and getting nonsense. No
    surprise.
    
    Had you used a static_cast instead of the C-style cast like
    this:
       f2( static_cast<CAST (*)(int)>(&f1), 4 );
    then the compiler would tell you quite correctly:
    tmp/g> /home/bangerth/bin/gcc-3.3x-pre/bin/c++ x.cc
    x.cc: In function `int main()':
    x.cc:18: error: invalid static_cast from type `int (*)(int)' to type `
       std::complex<double> (*)(int)'

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


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