What this C++ function-call resolution question tests
This is a Cracked-level C++ question that probes your understanding of function overload resolution and name lookup rules in modern C++. It's the kind of question interviewers at firms like Nvidia ask to verify that you can reason confidently about what code actually does, rather than guess based on intent.
The question asks you to trace through a code snippet and determine the output by applying C++ rules for function selection. This tests whether you understand how the compiler prioritizes candidates, handles implicit conversions, and resolves ambiguities in the presence of overloads, templates, or scope rules. The answer depends on precise knowledge of when each overload is viable and how the overload set is ranked.
- Overload resolution and candidate viability
- Implicit conversion sequences and their costs
- Scope and name-lookup order
- Template argument deduction and specialization