[CUDA 4.0 RC2] __constant__ inside namespace doesn't compile

The following piece of code doesn’t compile with CUDA 4.0RC2:

namespace X{

  __constant__ const int test = 1;


int main()



I can’t understant why it generates this kind of invalid ****.cudafe1.stub.c:

static void __sti____cudaRegisterAll_28_test_namespace_const_cpp1_ii_main(void)




                                      [local to test_namespace_const_cpp1_ii]:<img src='http://forums.nvidia.com/public/style_emoticons/<#EMO_DIR#>/bloated.gif' class='bbc_emoticon' alt=':X' />::test), 0, 4, 1, 0);


What is this -> [local to test_namespace_const_cpp1_ii] ???

Anyway, what happened with the cuda 4.0 compiler? It really is a serious regression

since cuda 3.2, did the CUDA team tried to rewrite the C++ compiler from scratch?

As I currently do not have access to a computer with a CUDA toolchain, I am unable to reproduce this. Since you indicate that this is a regression from CUDA 3.2 and you have a simple repro case in hand, could you please file a bug so our compiler team can look into this? Thank you for your help!