这是一则简单的C++语法测试,源自我写模板实现的时候遇到的问题:
template <typename = void>
struct c;
struct a {
    void foo() {}
    void bar() {}
};
struct b {
    template <typename>
    void foo() {
        static_cast<a&>(*this).foo();
    }
    template <typename T>
    void bar() {
        static_cast<a&>(static_cast<c<T>&>(*this)).bar();
    }
};
template <typename T>
struct c : b, a {
    void foo() { b::foo<T>(); }
    void bar() { b::bar<T>(); }
};
int main() {
    c<> c{};
    // which is well-formed?
    c.foo();
    c.bar();
}