import std.typecons : Tuple, tuple;
enum RC5Command: Tuple!(ubyte, ubyte) {
Standby = RC5Command(0,0)
}
unittest {
RC5Command rc5command = RC5Command.Standby;
rc5command = RC5Command.Standby; // This line
}
The above code fails to compile with:
Error: template std.typecons.Tuple!(ubyte, ubyte).Tuple.opAssign cannot deduce function from argument types !()(RC5Command), candidates are:
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/typecons.d(900,19):
opAssign(R)(auto ref R rhs)
with R = RC5Command
must satisfy the following constraint:
areCompatibleTuples!(typeof(this), R, "=")
The root cause of this is areCompatibleTuples checks isTuple!Tup2, and should check isTuple!(OriginalType!Tup2) to account for enums.
Comment #1 by dlang-bot — 2020-05-20T21:46:07Z
@Biotronic created dlang/phobos pull request #7489 "Fix issue 20850 - Can't assign enum of Tuple" fixing this issue:
- Fix issue 20850 - Can't assign enum of Tuple
https://github.com/dlang/phobos/pull/7489