[cfe-dev] CheckerRegistry.h + Version.h = clang::ento::clang ??

Gábor Kozár kozargabor at gmail.com
Mon Aug 26 07:11:44 PDT 2013


Hi,

I ran into an interesting problem today while using Clang 3.3. I managed to
reproduce the problem with this minimal test file:

#include "clang/StaticAnalyzer/Core/CheckerRegistry.h"

using namespace clang::ento;

using namespace clang; // ::clang or ::clang::ento::clang??

To which GCC 4.7.2 says:

test.cpp:5:17: error: reference to ‘clang’ is ambiguous
In file included from
.../include/clang/StaticAnalyzer/Core/CheckerRegistry.h:13:0,
                 from test.cpp:1:
.../include/clang/Basic/LLVM.h:52:17: error: candidates are: namespace
clang { }
In file included from
.../include/clang/StaticAnalyzer/Core/CheckerRegistry.h:66:0,
                 from test.cpp:1:
.../include/clang/Basic/Version.h:42:17: error:                 namespace
clang::ento::clang { }

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.

Is this intentional? I do not see any comments in the source code about
this.
Of course it is easily fixed on the user side by referring to "::clang"
instead of just "clang", but I'm still curious.

Thanks!

Gabor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130826/8acac5e4/attachment.html>


More information about the cfe-dev mailing list