digitalmars.D.bugs - [Issue 21570] New: __traits(isStaticArray, ...) accepts enums with
- d-bugmail puremagic.com (30/30) Jan 21 2021 https://issues.dlang.org/show_bug.cgi?id=21570
https://issues.dlang.org/show_bug.cgi?id=21570 Issue ID: 21570 Summary: __traits(isStaticArray, ...) accepts enums with static array as base type Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: moonlightsentinel disroot.org Example: ----------------------------------------------------------------- enum EnumArray : int[2] { a = [ 1, 2 ], b = [ 3, 4 ] } static assert(!__traits(isStaticArray, EnumArray)); // Fails // Expected equal behaviour of trait and is-expression static assert(!is(EnumArray == T[n], T, size_t n)); // Passes ----------------------------------------------------------------- The spec[1] states that a named enum creates a distinct type which is implicitly convertible to it's base type. So EnumArray is not a static array and __traits(isStaticArray, EnumArray) should yield `false` as done for the equivalent is-expression. [1] https://dlang.org/spec/enum.html#named_enums --
Jan 21 2021