Hello,
When trying to compile the following code with nvcc -std=c++20
:
#include <string>
#include <exception>
#include <source_location>
struct Error : public std::exception
{
public:
Error(std::source_location info = std::source_location::current())
{
msg_ = info.file_name();
}
private:
std::string msg_;
};
struct RuntimeError : public Error
{
using Error::Error;
};
int main(int argc, char* argv[])
{
RuntimeError error;
return 0;
}
I get the following error:
"<source>", line 21: internal error: assertion failed: compare_expressions: bad expr kind (il.cpp, line 8156 in compare_expressions)
};
^
1 catastrophic error detected in the compilation of "<source>".
Compilation aborted.
The code compile just fine when removing the inheritance or the source_location
header. It may be related with C++20’s source_location bug.
I am using (Arch) Linux and the CUDA v21.5
toolkit. I also wrote an example in godbolt.
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Jun__6_02:18:23_PDT_2024
Cuda compilation tools, release 12.5, V12.5.82
Build cuda_12.5.r12.5/compiler.34385749_0
g++ (GCC) 14.2.1 20240805
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.