Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Base {
- virtual void junk() = 0;
- };
- template <class T>
- struct Derived : Base {
- void junk() override {
- T::junkImpl();
- }
- void otherMethod() {
- }
- };
- template <class T>
- struct NotDerived {
- void junk() {
- T::junkImpl();
- }
- void otherMethod() {
- }
- };
- struct TypeWithJunk {
- void junkImpl() {
- }
- };
- struct TypeWithoutJunk {};
- void reproduce(NotDerived<TypeWithoutJunk>* ndt, Derived<TypeWithoutJunk>* dt) {
- // works - junk is not used, not instantiated
- ndt->otherMethod();
- // fails on MSVC - junk is instantiated even if not used
- dt->otherMethod();
- }
Add Comment
Please, Sign In to add comment