What this C++ template and language-semantics question tests
This is a medium-difficulty C++ question that probes your understanding of template instantiation, name resolution, and how the compiler handles implicit conversions and function overloading in templated contexts. It's the kind of question that separates candidates who have read the language spec from those who rely on intuition alone.
To work through this problem, you need to trace how the compiler resolves template parameters, instantiates function or class templates, and applies C++ lookup rules. Pay close attention to which overloads are viable, how dependent names are resolved, and what conversions the compiler will implicitly apply. The answer hinges on understanding the precise sequence of compile-time decisions, not just guessing the runtime output.
- Template parameter deduction and instantiation
- Argument-dependent lookup (ADL) and unqualified name lookup
- Implicit type conversions in template contexts
- Overload resolution order