http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57155
Bug #: 57155 Summary: casting to const reference error Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: rock...@gmail.com #include <assert.h> int main() { const char* buf = "12345678"; const int& cref = (const int&)buf[0]; const int& ref = ( int&)buf[0]; assert(cref == ref); return 0; } // Above assertion failed on g++4.1.2, g++4.4.6, g++4.7.1 and g++4.7.2 // These are all my tested g++ version // cref just got first byte of buf