Consider the following C++ code,
namespace {
class ExprParentFinder {
friend class CodeCompletionTypeContextAnalyzer;
};
}
class CodeCompletionTypeContextAnalyzer {
public:
CodeCompletionTypeContextAnalyzer() {}
};
int main() {
CodeCompletionTypeContextAnalyzer TypeAnalyzer;
return 0;
}
This compiles fine with Clang/GCC. However, MSVC chokes, and reports
1> ConsoleApplication2.cpp
1> consoleapplication2.cpp(29): error C2872: 'CodeCompletionTypeContextAnalyzer': ambiguous symbol
1> consoleapplication2.cpp(23): note: could be 'CodeCompletionTypeContextAnalyzer'
1> consoleapplication2.cpp(19): note: or '`anonymous-namespace'::CodeCompletionTypeContextAnalyzer'
Is CodeCompletionTypeContextAnalyzer TypeAnalyzer
really ambiguous here from a C++ standards point of view, or is this an MSVC bug. If so, what's causing this error.
The work around is to change the code to
int main() {
::CodeCompletionTypeContextAnalyzer TypeAnalyzer;
return 0;
}