spanning_vector: <T> type = {
view: * std::vector<T>;
operator=: (out this, inout v: std::vector<T>) = view = v&;
operator=: (inout this, inout v: std::vector<T>) = view* = v;
}
main: () = {
vec1: std::vector<i32> = (0, 1, 2);
vec2: std::vector<i32> = (3, 4, 5, 6, 7);
view: spanning_vector = vec1;
view = vec2;
assert(vec1 == vec2);
}
Title: Postfix operators of member assignment ignored.
Minimal reproducer (https://cpp2.godbolt.org/z/b8EEa6jnf):
Commands:
cppfront main.cpp2 clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -I . main.cppExpected result:
view = _;, or*view = v;(for the assignment to Just Work [BUG] move-assignment operators defaulting to memberwise semantics makes it impossible to cleanup old value #475 (comment)).Actual result and error:
view = v;Cpp2 lowered to Cpp1:
Output:
See also:
operator=within this(via function metafunction@proxy) #452 (comment).