Why Argument Dependent Lookup doesn't work with function template dynamic_pointer_cast
问题 Consider the following C++ program: #include <memory> struct A {}; struct B : A {}; int main() { auto x = std::make_shared<A>(); if (auto p = dynamic_pointer_cast<B>(x)); } When compiling with MSVC 2010, I obtain the following error: error C2065: 'dynamic_pointer_cast' : undeclared identifier The error persists if auto is replaced by std::shared_ptr<A> . When I fully qualify the call with std::dynamic_pointer_cast , the program successfully compiles. Also, gcc 4.5.1 doesn't like it either: