ultimatepp/uppdev/gccbug1/gccbug1.cpp
cxl 351994a6cc Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

36 lines
449 B
C++

#include <iostream>
struct Base {
int x;
int y;
};
struct Derived : Base {};
/*
struct Foo {
int a;
int b;
operator Bar() const;
};
struct Bar : Foo {
};
Foo::operator Bar() const { return *(Bar *)this; }
*/
void Do(Base& a)
{
Derived b = *(Derived *)&a;
std::cout << b.x << ", " << b.y << '\n';
}
int main(int argc, const char **argv)
{
Derived f;
f.x = 12345;
f.y = 54321;
Do(f);
return 0;
}