Skip to content

[BUG]: cuda::std::span<bool> brace initialization fails with narrowing conversion error #7619

Description

@PointKernel

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 to cuda::std::span<bool> internally using __nv_bool instead of bool.

How to Reproduce

https://godbolt.org/z/h4cM67hsT

Expected behavior

cuda::std::span should build and work as std::span in the given sample code.

Reproduction link

https://godbolt.org/z/h4cM67hsT

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

Activity

  1. miscco commented on Feb 10, 2026

    @miscco
    Contributor

    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

  2. miscco commented on Feb 11, 2026

    @miscco
    Contributor
  3. self-assigned this
    on Feb 11, 2026
  4. added theissue type on Feb 11, 2026
  5. bernhardmgruber commented on Mar 25, 2026

    @bernhardmgruber
    Contributor
  6. mhoemmen commented on Mar 25, 2026

    @mhoemmen
    Contributor

    @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.)

  7. bernhardmgruber commented on Mar 25, 2026

    @bernhardmgruber
    Contributor

    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.

  8. moved this from Todo to In Progress in CCCLon Mar 31, 2026
  9. miscco commented on Mar 31, 2026

    @miscco
    Contributor

    The paper has been published https://isocpp.org/files/papers/P4144R1.html

    We will remove the constructor as a bugfix

  10. mhoemmen commented on Mar 31, 2026

    @mhoemmen
    Contributor

    The 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.

  11. moved this from In Progress to Done in CCCLon Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

breakingBreaking changelibcu++For all items related to libcu++

Type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions