[Issue 20920] Typedef!int + Typedef!int => int? is this a typedef overlook?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 11 14:45:48 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20920

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Typedef was meant to replace the deprecated typedef feature.

If you look at D1's spec https://digitalmars.com/d/1.0/type.html, it claims
that if two identical typedefs are the parameters to a binary arithmetic
operator, the result should be the same type.

This works today with enums as well. This should be how Typedef operates.

The solution may be tricky, because one has to define opBinary for the specific
type, but must forward to the base type if there is no match.

--


More information about the Digitalmars-d-bugs mailing list