Repository navigation
change hasIndirections!void to true for consistency with TypeInfo - #22593
Conversation
…, so hasIndirections should match.
|
Thanks for your pull request, @schveiguy! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
|
@CyberShadow can you explain the failure in ae here and whether this points to a bug, or a misunderstanding of mine on |
|
The friction is coming from:
I think at this point it's clear that 1 was the wrong call. Practically speaking, I can adjust |
Yeah, I think that choice has impacted many over the years. I was curious about the implementation, and at least as far back as 12 years ago, the line inside std.file that allocates the array was: void[] result = uninitializedArray!(ubyte[])(initialAlloc);Allocating a |
Rationale: - void[] is unsuitable for raw data, as the language assumes it may contain pointers. An upcoming dmd change makes hasIndirections!void return true for consistency with TypeInfo, which means that void[] will no longer work where pointer-free types are expected. See: dlang/dmd#22593 Changes required: - Switch to using ubyte[] to represent "data from a file" instead of void[], or add casts where appropriate when calling iconv, sha1sum, or parseViaIMConvert.
I cannot possibly express just how strongly I agree with this. |
|
I tagged a new ae version (which passes a local |
|
Thanks, now passing |
…, so (dlang#22593) hasIndirections should match.
See issue #22517
An alternative fix considered was to special case
voidarrays in the array allocator. However,TypeInfo_v(voidtypeinfo) reports that it contains pointers. You can't create a variable of typevoid, only arrays ofvoid, so this shouldn't affect any existing code except to fix bugs (which assumed the same behavior fromhasIndirections!voidastypeid(void).flags()as the array runtime did).pinging @jmdavis as you added tests that needed to be reversed in #20813 last year. I'm assuming the tests added were for completeness, based on current behavior instead of an expectation of that behavior. If I'm wrong, please explain the thought behind the test.