November 27, 2018 [Issue 19439] New: Make __traits(getAliasThis) return empty tuple for non-aggregate types | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19439 Issue ID: 19439 Summary: Make __traits(getAliasThis) return empty tuple for non-aggregate types Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: n8sh.secondary@hotmail.com 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. -- |
Copyright © 1999-2021 by the D Language Foundation