Bug 19439 – Make __traits(getAliasThis) return empty tuple for non-aggregate types
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2018-11-27T05:52:11Z
Last change time
2018-12-30T16:07:10Z
Assigned to
No Owner
Creator
Nathan S.
Comments
Comment #0 by n8sh.secondary — 2018-11-27T05:52:11Z
It is frequently necessary to verify that aliasing is not occurring. Checking that the result of __traits(getAliasThis) has length 0 is a concise and natural way of doing this. Unfortunately it is currently disallowed to `getAliasThis` a non-aggregate type. Returning an empty tuple instead of raising a compile-time error would also be convenient for using `getAliasThis` in type-generic code. It should not make DMD slower to change this behavior: not raising an error slightly simplifies the logic.
Comment #1 by github-bugzilla — 2018-12-07T10:39:49Z