http://llvm.org/bugs/show_bug.cgi?id=12204
Bug #: 12204
Summary: static_cast to Base class overrides the Derived class
field.
Product: clang
Version: 3.0
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
struct Foo {
Foo() {};
int i;
short f;
};
struct Bar : public Foo {
Bar() {};
int b;
};
Bar b1, b2;
b2.i = 0;
b2.f = 1;
b2.b = 2;
b1.i = 3;
b1.f = 4;
b1.b = 5;
dynamic_cast<Foo&>(b1) = dynamic_cast<Foo&>(b2);
printf("b1.b = %d");
Output is 2 instead of 5.
static_cast restricted to the base class(Foo) should not have overridden the
Derived class field b. Please clarify.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs