模板函数匹配特化

HCS*_*CSF 11 c++ language-lawyer c++17

我在 GCC 10.0 和 Clang 10.0 中尝试了以下代码:

template <template <typename> typename>
struct Foo {
    Foo() { std::cout << "generic" << std::endl; }
};

template <typename>
struct Bar {};

template <typename T>
using Fake_Bar = Bar<T>;

template <>
struct Foo<Bar> {
    Foo() { std::cout << "specialization" << std::endl; }
};

int main() {
    Foo<Bar> a;
    Foo<Fake_Bar> b;
}
Run Code Online (Sandbox Code Playgroud)

他们给出了不同的输出:

海湾合作委员会:

specialization
specialization
Run Code Online (Sandbox Code Playgroud)

铛:

specialization
generic
Run Code Online (Sandbox Code Playgroud)

根据 C++17 标准,哪一个是正确的?规则是什么?