https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101872
Bug ID: 101872 Summary: static_cast succeeds in CRTP with incorrect type Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vpervouchine at gmail dot com Target Milestone: --- Created attachment 51296 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51296&action=edit Preprocessor output. See the actual code from line 11011 onwards static_cast of *this to an incorrect "Derived" class inside a CRTP base succeeds when Derived itself is a variadic template, leading to invalid addressing of member variables of the derived class. Since the preprocessed file doesn't include comments, please see them in the source file here: https://godbolt.org/z/oKv1xeK9G