🐛 Fix tuple_size_v for types which shouldn't have it - #416
Open
elbeno wants to merge 1 commit into
Open
Conversation
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.
elbeno
requested review from
SANTOSHKUMARLAXMINARAYANRAI,
lukevalenty,
mjcaisse-intel and
siauthun
September 4, 2026 22:54
elbeno
enabled auto-merge
September 4, 2026 22:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
has_tuple_protocolincorrectly succeeds on some platforms for types likestd::optional<T>because the primary template definition forstdx::tuple_size_vis:And on some platforms,
std::size_tisunsigned int, which means literally any type satisfieshas_vacuous_tuple_protocolconcept!Solution:
tuple_size_van invalid type.