NVIDIA / NVIDIA/cccl

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

Open
#8,952 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2.5k
Forks
487
Avg merge
2d 7h
Merged PRs (30d)
296

Description

### 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` 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:

```cpp
#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 #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` 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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.