我在看下面的代码:
#include <iostream>
void f()
{
std::cout << "Called ::f()" << std::endl;
}
struct S
{
void f()
{
std::cout << "Called S::f()" << std::endl;
}
void oops()
{
[this](){ f(); }(); // calls the wrong function
}
};
int main()
{
S().oops();
return 0;
}
( http://ideone.com/w7nyb )
VS2010调用::f()
,但GCC和VS2012调用S::f()
对我来说,似乎VS2012是正确的。
其功能应根据标准被称为?