-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
No response
Reproduction
#include <vector>
template <typename T>
struct MyVec {
MyVec() = default;
MyVec(std::vector<T> impl) : impl(impl) {}
std::vector<T> impl;
};
template <typename T>
T operator+(T lhs, T rhs) {
std::vector<T> lhsImpl;
std::vector<T> rhsImpl;
for (int i = 0; i < std::min(lhsImpl.size(), rhsImpl.size()); i++) {
lhsImpl[i] += rhsImpl[i];
}
return T(lhsImpl);
}
using MyIntVec = MyVec<int>;
let a = MyIntVec([1, 2, 3])
let b = MyIntVec([4, 5, 6])
let c = a + b // Binary operator '+' cannot be applied to two 'MyIntVec' (aka 'MyVec<CInt>') operands
Expected behavior
I expected the code would compile
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0
Additional information
rdar://151168686
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels