Bug 20850 – Can't assign enum of Tuple

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-05-20T21:27:58Z
Last change time
2020-05-22T02:33:36Z
Keywords
pull
Assigned to
No Owner
Creator
Simen Kjaeraas
See also
https://issues.dlang.org/show_bug.cgi?id=20854

Comments

Comment #0 by simen.kjaras — 2020-05-20T21:27:58Z
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
Comment #2 by schveiguy — 2020-05-21T21:07:05Z
This is essentially due to https://issues.dlang.org/show_bug.cgi?id=20854. But we can workaround this problem in Phobos until a dmd fix is available.
Comment #3 by dlang-bot — 2020-05-22T02:33:36Z
dlang/phobos pull request #7489 "Fix issue 20850 - Can't assign enum of Tuple" was merged into master: - e6eaa8ea24f33b1aac7a5c0ccf41d5d01397fe39 by Biotronic: Fix issue 20850 - Can't assign enum of Tuple https://github.com/dlang/phobos/pull/7489