nvcc bug w/ templaes - compiles .cpp but not .cu

Hi, I was using the CGAL libraries with my code and everything was fine until I tried to use this particular piece of code:
https://github.com/CGAL/cgal/blob/7180fe5bb3da062687af2a378a9d770248241cff/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h
So I decided to compile a minimal example with nvcc:
https://doc.cgal.org/latest/Triangulation_3/Triangulation_3_2copy_triangulation_3_8cpp-example.html
and I get the same errors I got with my own code:
https://gist.github.com/pgbarletta/659e9fe1ca01c45e8e29ea8e03ea0fcc

As long as the source file is named “.cpp" everything works fine, but if I change the ending to ".cu”, these template errors pop out.

I know this is lot to look at, but I’m just wondering: is anyone aware if nvcc is having some difficulties with templates?

$nvcc --version
Cuda compilation tools, release 9.0, V9.0.176

errors when compiling as:

nvcc as.cu -lCGAL -lmpfr -lgmp -lboost_thread

everything ok when compiling like:

nvcc as.cpp -lCGAL -lmpfr -lgmp -lboost_thread

I didn’t look carefully through your error output so, I may take a wild guess that CGAL uses many c++14 features. To enable those, you can try

nvcc -std=c++14 as.cu -lCGAL -lmpfr -lgmp -lboost_thread

Apologies if it is not helpful.

Oh, I forgot to say that I tried that too. In the end I just reordered my code, so these libraries only showed up in *cpp files.
Tahnks!

simple template does work fine for all nvcc’s that I’ve used,

https://github.com/fangq/mcx/blob/master/src/mcx_core.cu#L972

but I know CGAL code is heavy on template, especially latest standards, portability has always been an issue. try an old CGAL release perhaps.