Sunday, November 12, 2006

Fun compiler bugs

void bar() {}

namespace foo
{
using ::bar;
}

using namespace foo;
// namespace {}

int main(int argc, char * argv[])
{
bar();
return 0;
}

In VC6, the preceding block of code produces
error C2668: 'bar' : ambiguous call to overloaded function
and the error goes away when you uncomment "namespace {}". Yikes.

No comments:

Post a Comment