ADT puzzler
summary
Code shows calling f<0(...) that the compiler parses as f < 0 (a comparison) because the identifier isn’t known as a template, so template argument syntax never applies and ADL doesn’t run. Declaring any template named f beforehand — even a dummy `template<class> struct f;` — makes the parser treat f as a template, then overload lookup and ADL kicks in to find the intended overload. Trying to force it with a local template keyword in non-dependent code is a syntax error (C++17).
AI-written summary · about
related talks
51mArgument dependent lookup (ADL): name taxonomy, customization points & use cases
01h 05mDon’t Get Overloaded by C++ Overload Sets
01h 00mClass template argument deduction in C++17
01h 37mRethinking the Way We Do Templates in C++ even more
01h 01mClass Template Argument Deduction for Everyone
01h 08mCTAD: Complete Guide to Class Template Argument Deduction
05mChecking Functor Arguments in C++
05mSFINAE: Substitution Failure Is Not An Error
