I've got a strange compile error with intel compiler on linux.
So I did some tests with Compiler Explorer.
This code compiles fine on several compilers:
enum class Enum {a, b};
template <int>
struct Base {
template <Enum a, Enum b> void F(int) {}
};
template <int i>
struct Derived : Base<i> {
void G() {
Base<i>::F<Enum::a, Enum::b>(1);
}
};
int main() {
Derived<1> D;
}
But with x86-64 gcc 8.1, I get:
<source>: In member function 'void Derived<i>::G()':
<source>:12:36: error: no match for 'operator>' (operand types are 'Enum' and 'int')
Base<i>::F<Enum::a, Enum::b>(1);
~~~~~~~^~~~
This is a very similar error that what I got with the intel compiler. This example compiles fine on compiler explorer with icc 17 though.
In both cases, this compiles fine if I remove the second template parameter.
What's going on here? What workaround could I use?