Hello, please consider the following simple c++ code:
% cat Main.cc
//first alias
namespace original_namespace {} // decl 1
namespace client_namespace {
namespace alias_ns = original_namespace;
}
//second alias
namespace original_namespace {} //decl 2
namespace client_namespace {
namespace alias_ns = original_namespace;
}
This does not build with clang++ and does build with g++
. I get the following diagnosis:
Main.cc:16:11: error: redefinition of ‘alias_ns’ as different kind of symbol
namespace alias_ns = original_namespace;
^
Main.cc:16:1: note: previous definition was here:
namespace alias_ns = original_namespace;
^
Of course this is a silly example, but I came across this when some similar code was included again and again from different source files. I have put this into a simple single file to see if I was still getting the problem, and yes.
Even more surprising is when you comment decl2 of namespace original_namespace, no error ! I cannot understand why. Then I thought that maybe clang was mispointing the error that was in the second declaration of original_namespace. It is not the case, as only commenting the second alias instruction and keeping decl1 works.
I am using clang and llvm 2.7 (not svn)
Regards,
Romain