Hi!
CUDA 12.8 resolved another bug I reported some months ago, but introduced another relatively similar bug.
#include <array>
void test1() {
// Remove the constexpr std::size_t NUM, and use 5 directly, and it will compile
constexpr std::size_t NUM = 5;
const std::array<int, NUM> d_imgs{ 1, 2, 3, 4, 5 };
}
void test2() {
// Change the std::array size to something different from 5 and it will compile
const std::array<int, 5> d_imgs2{ 6, 7, 8, 9, 10 };
}
int main() {
return 0;
}
This code compiles on Windows (VS2022) (CUDA SDK 12.8.0 with nvcc 12.8.61)
It does not compile on Linux (Ubuntu 22.04 & 24.04) with CUDA SDK 12.8.1 with nvcc 12.8.93.
It does compile on Linux with nvcc from 11.8 to 12.6 (Did not try 12.8 without Update 1).
Error message:
bugNVCC128.cu: In function ‘void test2()’:
bugNVCC128.cu:11:42: error: template argument 2 is invalid
11 | const std::array<int, 5> d_imgs2{ 6, 7, 8, 9, 10 };
| ^
bugNVCC128.cu:11:45: error: scalar object ‘d_imgs2’ requires one element in initializer
11 | const std::array<int, 5> d_imgs2{ 6, 7, 8, 9, 10 };
| ^~~~~~~