<div dir="ltr"><div><div><div><div><div><div>Hi,<br><br>I ran into an interesting problem today while using Clang 3.3. I managed to reproduce the problem with this minimal test file:<br><br>#include "clang/StaticAnalyzer/Core/CheckerRegistry.h"<br>
<br>using namespace clang::ento;<br><br>using namespace clang; // ::clang or ::clang::ento::clang??<br><br></div>To which GCC 4.7.2 says:<br><br>test.cpp:5:17: error: reference to ‘clang’ is ambiguous<br>In file included from .../include/clang/StaticAnalyzer/Core/CheckerRegistry.h:13:0,<br>
from test.cpp:1:<br>.../include/clang/Basic/LLVM.h:52:17: error: candidates are: namespace clang { }<br>In file included from .../include/clang/StaticAnalyzer/Core/CheckerRegistry.h:66:0,<br> from test.cpp:1:<br>
.../include/clang/Basic/Version.h:42:17: error: namespace clang::ento::clang { }<br><br></div>Looking at CheckerRegistry.h and Version.h, it is evident what the problem is: CheckerRegistry.h includes Version.h while already inside the clang::ento namespace, and Version.h also starts a clang namespace, whose full name will thus be ::clang::ento::clang.<br>
<br></div>Is this intentional? I do not see any comments in the source code about this.<br></div>Of course it is easily fixed on the user side by referring to "::clang" instead of just "clang", but I'm still curious.<br>
<br></div>Thanks!<br><br></div>Gabor<br></div>