2.0 bug concerning templated kernel in a namespace

This used to compile okay in CUDA 1.1:

namespace foobar


template<typename T>

  __global__ void bar(void)


} // end bar()


void foo(void)




It generates an error after updating to CUDA 2.0b.

Error message:

jared@filthy:~/bug$ nvcc bug.cu

In file included from bug.cu:17:

/tmp/tmpxft_00006054_00000000-1_bug.cudafe1.stub.c:18: error: expected initializer before ‘<’ token

nvcc version:

jared@filthy:~/bug$ nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver

Copyright (c) 2005-2007 NVIDIA Corporation

Built on Tue_Jun_10_04:42:57_PDT_2008

Cuda compilation tools, release 1.1, V0.2.1221

This is on Ubuntu Hardy 64b. I haven’t found a workaround short of making the kernel not a template, or moving it out of the namespace.