http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54606
Bug #: 54606 Summary: reference assignment failing/points at previous object Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: g...@gyw.com Created attachment 28203 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28203 Sample code When one assigns a reference to a variable, the value doesn't point at the new object. It keeps referring to the previous object. A& a = X; a.a(); // calls X::a() a = Y; a.a(); // Still calls X::a(), not Y::a(). Corresponding code using pointers works. References and pointers should handle dynamic dispatch the same way. Tried g++ 4.4, 4.5 and 4.6 on Ubuntu and Debian.