MSVC's experimental flag `/experimental:constevalVfuncNoVtable` omits the vtable for classes whose virtual functions are all `consteval`, but this produces non-conforming behavior. Under this mode, types with virtual methods are incorrectly reported as non-polymorphic, `sizeof` changes, and `typeid` returns the wrong dynamic type at runtime. The post explains why giving a class two different layouts is impossible, why omitting the vptr breaks type traits and RTTI, and concludes that the conforming alternative is `/experimental:constevalVfuncVtable`, which matches GCC and Clang behavior.

3m read timeFrom quuxplusone.github.io
Post cover image

Sort: