https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25548
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| | Keywords|accepts-invalid |rejects-valid --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Hmm, EDG and MSVC accept the code for both GetChar having Foo and char as return types. Even accepts this and runs correctly: ``` class Foo {}; Foo a; struct Bing { Foo *GetChar(){return &a;} }; template<typename T> struct Bar { void Wibble() { bing.GetChar()->~T(); // How can this be legal if T isn't char? } Bing bing; }; int main(){Bar<Foo> a;a.Wibble();} ``` Also Clang has the same error message as GCC here (for `Foo*` return type only). I am not sure if there is not a defect report in this area even.