This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [patch] fix for c++/2416


On Tue, Apr 01, 2008 at 11:33:32AM -0400, Aleksandar Ristovski wrote:
> I believe we should.
> 
> Here is a dummy c++ program where this is done explicitly:
> 
> #include <iostream>
> using namespace std;
> int main ()
> {
>    int a = 42;
>    int &refa = (int &)a; // cast not needed, yet compiler doesn't complain.
>    cout << refa << endl;
>    return 0;
> }

I had to ask two C++ experts what this meant and let them argue about
it for a little while... it's even legal if a is a double.  This is
*reinterpret_cast<int *>(&a), an lvalue of type int.  That's not what
GDB will do with it, but it's close enough for now.

If you'll delete the extra blank line, the patch and testcases are OK.
Thanks for your patience.

-- 
Daniel Jacobowitz
CodeSourcery


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