Issue |
69288
|
Summary |
Compiling with clang cuda fails when using libstdc++'s <format> header
|
Labels |
clang
|
Assignees |
|
Reporter |
rnburn
|
Take this program
```
// main.cc
#include <format> // remove the format include and everything will work
#include <iostream>
int main() {
std::cout << "hello, hello\n";
return 0;
}
```
If I compile with
```
clang++ -std=c++23 main.cc
```
Everything works fine.
But if I compile with
```
clang -x cu --cuda-gpu-arch=sm_70 --cuda-gpu-arch=sm_70 -std=c++23 -c main.cc
```
I get the error below.
I'm using a version of clang I compiled from trunk against gcc13's libstdc++.
```
clang++ --version
clang version 18.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nixos/.nix-profile/bin
```
This is the flake I used to build clang:
https://github.com/rnburn/nix-flakes/blob/f5ac34af8b5901e0d4d02cf83330739afae4f75e/flake.nix
Error
```
In file included from main.cc:1:
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3528:36: error: non-virtual member function marked 'override' hides virtual member function
3528 | _M_on_chars(iterator __last) override
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3621:55: note: in instantiation of template class 'std::__format::_Formatting_scanner<std::__format::_Sink_iter<char>, char>' requested here
3621 | _Formatting_scanner<_Sink_iter<_CharT>, _CharT> __scanner(__ctx, __fmt);
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3652:24: note: in instantiation of function template specialization 'std::__format::__do_vformat_to<std::__format::_Sink_iter<char>, char, std::basic_format_context<std::__format::_Sink_iter<char>, char>>' requested here
3652 | { return __format::__do_vformat_to(std::move(__out), __fmt, __args); }
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3679:10: note: in instantiation of function template specialization 'std::vformat_to<std::__format::_Sink_iter<char>>' requested here
3679 | std::vformat_to(__buf.out(), __fmt, __args);
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3478:30: note: hidden overloaded virtual function 'std::__format::_Scanner<char>::_M_on_chars' declared here
3478 | constexpr virtual void _M_on_chars(iterator) { }
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3535:34: error: non-virtual member function marked 'override' hides virtual member function
3535 | _M_format_arg(size_t __id) override
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3509:30: note: hidden overloaded virtual function 'std::__format::_Scanner<char>::_M_format_arg' declared here
3509 | constexpr virtual void _M_format_arg(size_t __id) = 0;
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3528:36: error: non-virtual member function marked 'override' hides virtual member function
3528 | _M_on_chars(iterator __last) override
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3621:55: note: in instantiation of template class 'std::__format::_Formatting_scanner<std::__format::_Sink_iter<wchar_t>, wchar_t>' requested here
3621 | _Formatting_scanner<_Sink_iter<_CharT>, _CharT> __scanner(__ctx, __fmt);
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3658:24: note: in instantiation of function template specialization 'std::__format::__do_vformat_to<std::__format::_Sink_iter<wchar_t>, wchar_t, std::basic_format_context<std::__format::_Sink_iter<wchar_t>, wchar_t>>' requested here
3658 | { return __format::__do_vformat_to(std::move(__out), __fmt, __args); }
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3688:10: note: in instantiation of function template specialization 'std::vformat_to<std::__format::_Sink_iter<wchar_t>>' requested here
3688 | std::vformat_to(__buf.out(), __fmt, __args);
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3478:30: note: hidden overloaded virtual function 'std::__format::_Scanner<wchar_t>::_M_on_chars' declared here
3478 | constexpr virtual void _M_on_chars(iterator) { }
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3535:34: error: non-virtual member function marked 'override' hides virtual member function
3535 | _M_format_arg(size_t __id) override
| ^
/nix/store/mwz5ch896ykn5zyjdgzar0zc9f9phm69-gcc-13.1.0/lib64/gcc/x86_64-unknown-linux-gnu/13.1.0/../../../../include/c++/13.1.0/format:3509:30: note: hidden overloaded virtual function 'std::__format::_Scanner<wchar_t>::_M_format_arg' declared here
3509 | constexpr virtual void _M_format_arg(size_t __id) = 0;
| ^
4 errors generated when compiling for sm_70.
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs