https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64049
--- Comment #5 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- (In reply to Andrew Pinski from comment #4) > v.value.LocalizedText = (LocalizedTextStruct*) "Localized Text"; > > > if you access v.value.LocalizedText as a LocalizedTextStruct the above > causes undefined code. I stripped that down from a much larger example. The point is, that ValueStruct1.cpp is mis-compled, and it cannot know what I did in ValueStruct2.cpp. However it is easy to re-write the test case so that it does not require any type casts.