Nvcc 12.2.1 unable to compile template with variadic template template parameter

Ubuntu 22.04
Cuda compilation tools, release 12.2, V12.2.140

nvcc fails to compile this code:

template<typename T>
struct Container1 {
    T * p;
};

template<typename T, typename U>
struct Container2 {
    T * p;
    U u;
};

template<template <typename, typename...> class Container, typename Element, typename ... OtherArgs>
void resize(Container<Element, OtherArgs...> & c, size_t size) {
}

int main() {
    Container1<int> c1;
    Container2<int, bool> c2;
    resize(c1, 42); // fails with error: no instance of function template "resize" matches the argument list
    resize(c2, 42);
}

gcc 11.4 is doing fine:

Is this an nvcc bug?

my suggestion is to file a bug.

Done. Bug ID is 4315432

1 Like