Skip to content

[BUG]: tuple_size_structured_bindings test fails on MSVC — late tuple_size specialization not picked up by structured binding #8952

@alliepiper

Description

@alliepiper

Type of Bug

Runtime Error

Component

libcu++

Describe the bug

std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_structured_bindings.pass.cpp fails at line 153 on MSVC:

Assertion failed: p == -1, ... tuple_size_structured_bindings.pass.cpp, line 153

test_after_tuple_size_specialization declares Test const t{99}, then auto& [p] = t after a std::tuple_size<Test> specialization and matching get<0> returning -1. clang/gcc route the binding through the tuple protocol (p == -1); MSVC keeps binding to the underlying member (p == 99).

The test already guards an analogous NVRTC quirk:

#if !_CCCL_COMPILER(NVRTC) // nvbug4053842
  assert(p == -1);
#endif

MSVC needs an equivalent guard, or the structured-binding lookup needs to honor late tuple_size specializations under MSVC.

Reproduces on every MSVC libcu++ Test job: CTK12.9/MSVC14.44 and CTK13.2/MSVC14.50, C++20, RTX4090 and H100. Discovered while enabling libcu++ MSVC GPU jobs in #5725, which marks the test // UNSUPPORTED: msvc to unblock; this issue tracks the underlying behavior.

How to Reproduce

  1. Check out PR Enable MSVC GPU jobs for CCCL projects #5725.
  2. Build and run libcudacxx.test.lit against MSVC (CTK12.9/MSVC14.44 or CTK13.2/MSVC14.50, C++20).

Expected behavior

After specializing std::tuple_size<Test> with value = 1 and a matching get<0> returning -1, auto& [p] = t should bind p to -1, matching clang/gcc.

Operating System

Windows Server (CI runner image)

NVCC version

CTK 12.9 (MSVC 14.44.35207) and CTK 13.2 (MSVC 14.50.35717).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions