Will the following code compile?
template <class T>
struct A {
  template <class K> void Foo() {
    typename K::test(T())->bar(10 - K(), A())++;
  }
};

void Test() {
  A<int> a;
}
Explanation
Yes, since A<T>::Foo<K>() is never called, so the compiler will not generate code for this method.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes