I found that in Visual Studio 2019 v16.8, the class invoking multiple-layer of inheritance cannot find its deep base class unless import the related module explicitly.
intrfce.ixx file:
export module intrfce;
export class Interface {
public:
virtual void Fun() = 0;
};
imp_a.ixx file:
export module imp_a;
import intrfce;
export class ImpA : public Interface {
public:
void Fun() override {}
};
imp_b.ixx file:
export module imp_b;
import imp_a;
export class ImpB : public ImpA {
public:
void Fun() override {}
};
When building these files, the IDE shows there is an error in imp_b.ixx:
imp_b.ixx(5,33): error C2230: could not find module 'intrfce'
If I import the intrfce explicitly in imp_b.ixx, it will succeed.
export module imp_b;
import intrfce;
import imp_a;
export class ImpB : public ImpA {
public:
void Fun() override {}
};
But it does not make sense that a class needs to explicitly import all its deep base classes.
Is it a bug or a new standard rule of C++20?
Thank you