The following code compiles fine with clang and gcc but gives this error with icc:
icc -std=c++11 problem.cpp
problem.cpp(12): error: expression must have a constant value
, typename std::enable_if<MyCheck<T>{}>::type
^
compilation aborted for problem.cpp (code 2)
#include <type_traits>
template<class T>
struct MyCheck {
constexpr operator bool() const {
return sizeof(T) > sizeof(int);
}
};
template<
class T
, typename std::enable_if<MyCheck<T>{}, int>::type
>
void f() {
}
int main() {
return 0;
}