[all-commits] [llvm/llvm-project] 2dce11: [libc++] Fix constraint recursion in std::expected...
Louis Dionne via All-commits
all-commits at lists.llvm.org
Thu Jun 4 13:52:06 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2dce1190b0aae797996023783731efbfb8e33a8f
https://github.com/llvm/llvm-project/commit/2dce1190b0aae797996023783731efbfb8e33a8f
Author: Louis Dionne <ldionne.2 at gmail.com>
Date: 2026-06-04 (Thu, 04 Jun 2026)
Changed paths:
M libcxx/include/__expected/expected.h
M libcxx/test/std/utilities/expected/expected.expected/equality/equality.T2.pass.cpp
Log Message:
-----------
[libc++] Fix constraint recursion in std::expected's operator== (#201455)
The C++26 constraint added to operator==(const expected& x, const T2& v)
by P3379R0 evaluates *x == v as part of constraint satisfaction. When
ADL on a comparison reaches this hidden friend through a type whose
associated namespaces include std::expected -- for example std::pair<T,
std::expected<U, V>> -- the constraint check ends up considering the
same overload again with the original type as T2, producing a
"satisfaction of constraint depends on itself" error.
Parameterize the expected operand with an extra template parameter
constrained to be the same type as the enclosing expected's value type.
This is observationally equivalent but makes template argument deduction
fail for non-expected operands before the constraint is evaluated, so
the recursion never starts.
Fixes #160431
rdar://178226313
Assisted-by: Claude
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list