Assignment of tuples
Russel Winder
russel at winder.org.uk
Wed May 20 12:17:54 UTC 2020
So I have an enum:
enum RC5Command: Tuple!(ubyte, ubyte) {
Standby = tuple(to!ubyte(0x10), to!ubyte(0x0c)),
…
I can do:
RC5Command rc5command = RC5Command.CD;
However, if I do:
rc5command = RC5Command.BD;
I get:
source/functionality.d(80,16): 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, "=")
which is totally unreasonable. And yet D insists. I guess there is an
explanation, but mostly this seems like a bug.
--
Russel.
===========================================
Dr Russel Winder t: +44 20 7585 2200
41 Buckmaster Road m: +44 7770 465 077
London SW11 1EN, UK w: www.russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20200520/973628a5/attachment.sig>
More information about the Digitalmars-d-learn
mailing list