Syntax highlighting fails for *.cu files for template instantiations with typedef'ed types

Consider the following source code:

#include <vector_types.h>

typedef int myint;

struct TestClass
  template <typename T>
  void Fun(float x)

template <typename T>
void TestFun(float x)

int main(int argc, char** argv)
  TestClass tc;



  return 0;

If this code is saved as a C++ (.cpp) file, all of the syntax highlighting works.

If this code is saved as a CUDA (.cu) file, only the expressions “tc.Fun(3)” and “TestFun(3)” have working syntax highlighting. Both the instantiation with the internal CUDA type “int1” and my own typedef’ed type “myint” are marked as red lines and the mousover text says
“Type ‘myint’ could not be resolved”.

This is strange, because pressing control and clicking on “myint” instantly jumps to the correct typedef.

Also note that this works just fine when the file is saved as a C++ file.

Operating System: Fedora 29
GCC: 8.2.1
CUDA: 10.1
Eclipse: 2018-09 (4.9)
Eclipse CDT:

Same error for eclipse versions:

Eclipse: 2018-12 (4.10)
CDT: 9.6.0

and the currently newest:

Eclipse: 2019-03 (4.11.0)
CDT: 9.7.0

We are looking into this issue. In the meantime you can change the project settings to the following to get rid of this error.

Right click on the project -> Properties-> C/C++ General->Language Mappings->Add-> Select content type as “CUDA C Source File” and language as “GNU C++”.

Thanks for looking into it!

This breaks the rest of the CUDA syntax highlighting, so we will wait for a fix.

Hi kjalaludeen, is this issue being worked on? Should I create a bug for this in the bugtracker?