I have discovered that the minimal example below works on gcc and clang and even Visual Studio but it does not compile with icc. I am trying to determine whether or not this is valid C++, but I am not able to find the relevant parts of the standard that answer my question since this is several different concepts combined.
// 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;
}
With icc (16.0.3), compilation gives the following error:
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
Is this valid C++?
To me it seems like it should be, because C
has a default value for its second template parameter, meaning that F<D>
with F = C
should be a valid construction.