Repository navigation
[BUG]: cuda::std::span<bool> brace initialization fails with narrowing conversion error #7619
Description
Activity
Unfortunately, this looks like it is not an issue with our implementation, but some unfortunate interaction with the new initilizer_list constructor from C++26
explicit(extent != std::dynamic_extent)
constexpr span( std::initializer_list<value_type> il ) noexcept;If you try the same code with C++26, it will also fail to compile with the same error https://godbolt.org/z/3nn5aKEPb
The error goes away if the span is not const https://godbolt.org/z/nEc6hY5T6 or if another type other than bool is used https://godbolt.org/z/x6GK5aqeY
Reacted by David Bayer@mhoemmen wrote a paper: http://wg21.link/P4144
@bernhardmgruber It might not be in the wg21 paper system yet. The paper has not yet been voted into the Standard (that would happen Saturday) and it WILL be revised. Please contact me offline for more details (ISO rules govern what we can say in public). (The outcome is likely good for this issue.)
It might not be in the wg21 paper system yet. The paper has not yet been voted into the Standard (that would happen Saturday) and it WILL be revised.
Well, I expect it to be in the post-Croydon mailing and then the link will work. I also omitted the revision, so the link stays up to date. My intend is just to link this issue with the paper.
Please contact me offline for more details
No need, I can lookup the minutes if I want to. I think @miscco and @griwes are following up with this issue.
Reacted by Mark HoemmenReacted by Mark Hoemmen- linked a pull request that will close this issueRemove span’s `initializer_list` constructor for C++26 (P4144R1) #8244
on Mar 31, 2026 The paper has been published https://isocpp.org/files/papers/P4144R1.html
We will remove the constructor as a bugfix
Reacted by Mark HoemmenReacted by Mark HoemmenThe paper P4144R1 has been published, but won't be in the wg21.link system until the post-Croydon comes out in the middle of next month.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Is this a duplicate?
Type of Bug
Compile-time Error
Component
libcu++
Describe the bug
Brace initialization {} of
cuda::std::span<bool>fails with narrowing conversion errors, while parentheses initialization () works. This inconsistency is due tocuda::std::span<bool>internally using__nv_boolinstead of bool.How to Reproduce
https://godbolt.org/z/h4cM67hsT
Expected behavior
cuda::std::spanshould build and work asstd::spanin the given sample code.Reproduction link
https://godbolt.org/z/h4cM67hsT
Operating System
No response
nvidia-smi output
No response
NVCC version
No response