[Issue 20316] array properties fail hasMember
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 30 09:30:19 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20316
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |razvan.nitu1305 at gmail.com
--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
The problem here is that (int[]).length is not a valid D construction:
static assert(__traits(compiles, (int[]).length));
will fail, therefore traits(hasMember) returns false.
length, ptr and capacity were thought to work solely on expressions, not on
types (it doesn't make sense to get the pointer of a type) so I'm a bit
confused of what the compiler should do here.
sizeof and alignof work because there are type properties.
--
More information about the Digitalmars-d-bugs
mailing list