Bug 19482 – attributes incorrectly applied to static foreach local variables
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-12-12T23:10:26Z
Last change time
2021-11-02T14:28:38Z
Keywords
C++, industry, pull
Assigned to
No Owner
Creator
Manu
Comments
Comment #0 by turkeyman — 2018-12-12T23:10:26Z
extern(C++) class foo
{
static foreach (i; 0 .. 100)
{
}
}
> Error : Internal Compiler error : type `int[]` can not be mapped to C++
Build using latest DMD for Win64.
Comment #1 by iamthewilsonator — 2018-12-12T23:59:33Z
Comment #3 by iamthewilsonator — 2018-12-13T03:34:58Z
> It doesn't give anything, because the ICE... ;)
Haha. And if you comment out the ICE?
Comment #4 by timon.gehr — 2018-12-13T04:04:29Z
The issue is that type qualifiers in the context are applied to `static foreach`-local variables. This behavior is unintended and changing it will fix the ICE.
E.g.:
immutable static foreach(i;0..1) pragma(msg, typeof(i));
will print `immutable(int)`, but it should print `int`.
Comment #5 by turkeyman — 2018-12-13T07:46:49Z
Oh wow. Yeah, that's pretty broken :)
Comment #6 by moonlightsentinel — 2021-04-04T19:18:42Z
The initial test case compiles fine with current master
Comment #7 by timon.gehr — 2021-04-05T06:56:07Z
(In reply to moonlightsentinel from comment #6)
> The initial test case compiles fine with current master
Can confirm (using wine on linux). However, it seems the underlying issue remains unfixed, changing title.
Comment #8 by dlang-bot — 2021-11-01T05:48:39Z
@BorisCarvajal created dlang/dmd pull request #13253 "Fix Issue 19482 - attributes incorrectly applied to static foreach local variables" fixing this issue:
- Fix Issue 19482 - attributes incorrectly applied to static foreach local variables
https://github.com/dlang/dmd/pull/13253
Comment #9 by dlang-bot — 2021-11-02T14:28:38Z
dlang/dmd pull request #13253 "Fix Issue 19482 - attributes incorrectly applied to static foreach local variables" was merged into master:
- 0409dfc969e8e7794e6a2b6971b30f9e26b15cae by Boris Carvajal:
Fix Issue 19482 - attributes incorrectly applied to static foreach local variables
https://github.com/dlang/dmd/pull/13253