我发现下面的最小例子适用于gcc和clang甚至Visual Studio,但它不能用icc编译.我试图确定这是否是有效的C++,但我无法找到回答我的问题的标准的相关部分,因为这是几个不同的概念组合.
// struct with multiple template parameters
template<typename A, typename B = int>
struct C
{
};
// struct that tries to use C's default second parameter without specifying it
template<typename D, template<typename E, typename ...> class F>
struct G
{
F<D> h;
};
int main()
{
G<char, C> i;
}
Run Code Online (Sandbox Code Playgroud)
使用icc(16.0.3),编译会出现以下错误:
struct.cpp(12): error: too few arguments for template template parameter "F"
F<D> h;
detected during instantiation of class "G<D, F> [with D=char, F=C]" at line 17
Run Code Online (Sandbox Code Playgroud)
这是有效的C++吗?
对我来说似乎应该是,因为 …