The following code compiles fine with clang and g++ (-std=c++14) but fails with icc 2016:
#include <iostream>
template<class Derived>
struct ConstBase {
template<bool T = true>
int f() const {
return 3;
}
};
template<class Derived>
struct Base : ConstBase<Derived> {
using ConstBase<Derived>::f;
template<bool T = true>
int f() {
const Derived& derived = static_cast<const Derived&>(*this);
return derived.f();
}
};
struct A : Base<A> {
};
int main() {
A a;
std::cout << a.f() << "\n";
return 0;
}