digitalmars.D - Today's compiler error message
- IchorDev (21/21) Jul 12 2023 While writing some mixins I accidentally used `alias` instead of
- Dennis (7/9) Jul 12 2023 Do you have a test case that reproduces it? I tried:
- IchorDev (7/17) Jul 12 2023 No, I simply don’t have the time for that. Compiler oddities tend
- Dennis (4/7) Jul 13 2023 That gives a parse error inside the mixin, since a string literal
- IchorDev (5/8) Jul 13 2023 Not that version of it. Some of the code was meh, so I've already
- Stefan Koch (7/17) Jul 14 2023 Do you know how to use the dustmite tool?
- IchorDev (32/38) Jul 17 2023 Never used it before.
While writing some mixins I accidentally used `alias` instead of `enum` for a string manifest constant. Compiling with GDC helped me locate the issue, as it gave an appropriate error message: ``` error: alias ‘bgfx.Attachment._init1094248_mangleof’ cannot alias an expression ‘"_ZN4bgfx10Attachment4initENS_13TextureHandleENS_6Access4EnumEttth"’ [...] ``` DMD and LDC2, however, decided that the real problem was an unmarked lambda placed within a mixin statement at module-scope: ``` ../bindbc-bgfx/source/bgfx/package.d:1906:17: error: array literal in ‘ nogc’ function ‘bgfx.Resolution.__lambda18’ may cause a GC allocation [...] ``` and switching the `alias` declaration for `enum` made it work. Highly informative as always...
Jul 12 2023
On Wednesday, 12 July 2023 at 15:53:39 UTC, IchorDev wrote:DMD and LDC2, however, decided that the real problem was an unmarked lambda placed within a mixin statement at module-scope:Do you have a test case that reproduces it? I tried: ```D alias y = mixin("``"); ``` But that gives the "alias `y` cannot alias an expression `""`" error.
Jul 12 2023
On Wednesday, 12 July 2023 at 16:00:34 UTC, Dennis wrote:On Wednesday, 12 July 2023 at 15:53:39 UTC, IchorDev wrote:No, I simply don’t have the time for that. Compiler oddities tend to be very painful to narrow down. The code is more like… mixin(“alias y = `”~someFn.mangleof~”`;”); mixin(“someOtherFn(…, y);”); But I doubt that’s enough to recreate it either.DMD and LDC2, however, decided that the real problem was an unmarked lambda placed within a mixin statement at module-scope:Do you have a test case that reproduces it? I tried: ```D alias y = mixin("``"); ``` But that gives the "alias `y` cannot alias an expression `""`" error.
Jul 12 2023
On Wednesday, 12 July 2023 at 21:52:08 UTC, IchorDev wrote:No, I simply don’t have the time for that.Is the code base public by any chance?The code is more like… mixin(“alias y = `”~someFn.mangleof~”`;”);That gives a parse error inside the mixin, since a string literal is not allowed in that position.
Jul 13 2023
On Thursday, 13 July 2023 at 10:41:06 UTC, Dennis wrote:On Wednesday, 12 July 2023 at 21:52:08 UTC, IchorDev wrote:Not that version of it. Some of the code was meh, so I've already replaced a lot of it now. There's several layers of possible causes for such a strange error, I don't think anyone could repro. it very easily.No, I simply don’t have the time for that.Is the code base public by any chance?
Jul 13 2023
On Thursday, 13 July 2023 at 10:54:30 UTC, IchorDev wrote:On Thursday, 13 July 2023 at 10:41:06 UTC, Dennis wrote:Do you know how to use the dustmite tool? [https://github.com/CyberShadow/DustMite] If not please get familiar with it and reduce the bug in your codebase. Cheers, StefanOn Wednesday, 12 July 2023 at 21:52:08 UTC, IchorDev wrote:Not that version of it. Some of the code was meh, so I've already replaced a lot of it now. There's several layers of possible causes for such a strange error, I don't think anyone could repro. it very easily.No, I simply don’t have the time for that.Is the code base public by any chance?
Jul 14 2023
On Friday, 14 July 2023 at 07:58:36 UTC, Stefan Koch wrote:Do you know how to use the dustmite tool? [https://github.com/CyberShadow/DustMite] If not please get familiar with it and reduce the bug in your codebase. Cheers, StefanNever used it before. I had an issue yesterday where an alias from a mixin was not being found by a module that was being used by an import of the module where the alias was declared. Like this: A: ```d import B; mixin(" import foreign.code; alias x = foreign.code.y!false; "); ``` B: ```d import C; C.Type blabla; ``` C: ```d import A; struct Type{} A.x(); //ERROR! Undefined identifier! ``` Perhaps DustMite would be good for reducing this kind of error to its components as well. I’ll look into it if I find any more weird ones. :) I think we need a dedicated thread for sharing obtuse compiler messages, alongside what the *actual* error ended up being. Often the compilers really just doesn’t understand how to tell us what we did wrong. Especially if the error is a bit weird, like a missing quote.
Jul 17 2023