Skip to content

🐛 Fix tuple_size_v for types which shouldn't have it - #416

Open
elbeno wants to merge 1 commit into
intel:mainfrom
elbeno:fix-tuple-size-v
Open

🐛 Fix tuple_size_v for types which shouldn't have it#416
elbeno wants to merge 1 commit into
intel:mainfrom
elbeno:fix-tuple-size-v

Conversation

@elbeno

@elbeno elbeno commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem:

  • The concept has_tuple_protocol incorrectly succeeds on some platforms for types like std::optional<T> because the primary template definition for stdx::tuple_size_v is:
template <typename T> constexpr auto tuple_size_v = 0u;

And on some platforms, std::size_t is unsigned int, which means literally any type satisfies has_vacuous_tuple_protocol concept!

Solution:

  • Make the primary template definition of tuple_size_v an invalid type.

Problem:
- The concept `has_tuple_protocol` incorrectly succeeds on some platforms for
  types like `std::optional<T>` because the primary template definition for
  `stdx::tuple_size_v` is:

```cpp
template <typename T> constexpr auto tuple_size_v = 0u;
```

  And on some platforms, `std::size_t` is `unsigned int`, which means literally
  any type satisfies `has_vacuous_tuple_protocol` concept!

Solution:
- Make the primary template definition of `tuple_size_v` an invalid type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant