Bug 21659 – [OSX] core.stdc.config.__c_ulonglong is forward referenced while looking for sizeof
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Mac OS X
Creation time
2021-02-24T07:38:49Z
Last change time
2021-02-24T13:18:59Z
Keywords
industry, pull, rejects-valid
Assigned to
No Owner
Creator
Mathias LANG
Comments
Comment #0 by pro.mathias.lang — 2021-02-24T07:38:49Z
Compiling the following with the latest (v2.095.1) on OSX:
```
import core.stdc.inttypes;
import std.bitmanip;
void main ()
{
uint64_t record;
auto x = nativeToLittleEndian(record)[0 .. typeof(record).sizeof];
}
```
Will trigger the following error:
```
/usr/local/opt/dmd/include/dlang/dmd/core/stdc/config.d(121): Error: enum core.stdc.config.__c_ulonglong is forward referenced when looking for sizeof
/usr/local/opt/dmd/include/dlang/dmd/std/bitmanip.d(2958): Error: template instance std.bitmanip.EndianSwapper!(__c_ulonglong) error instantiating
/usr/local/opt/dmd/include/dlang/dmd/std/bitmanip.d(3092): instantiated from here: nativeToEndianImpl!(false, __c_ulonglong)
reg.d(7): instantiated from here: nativeToLittleEndian!(__c_ulonglong)
/usr/local/opt/dmd/include/dlang/dmd/core/stdc/config.d(121): Error: enum core.stdc.config.__c_ulonglong is forward referenced when looking for sizeof
/usr/local/opt/dmd/include/dlang/dmd/std/bitmanip.d(2966): Error: template instance std.bitmanip.ctfeBytes!(__c_ulonglong) error instantiating
/usr/local/opt/dmd/include/dlang/dmd/std/bitmanip.d(3092): instantiated from here: nativeToEndianImpl!(false, __c_ulonglong)
reg.d(7): instantiated from here: nativeToLittleEndian!(__c_ulonglong)
```
However, it will work fine on Linux. This error appeared also on Linux in an release (v2.078 to v2.080) but was fixed.
Comment #1 by dlang-bot — 2021-02-24T07:59:29Z
@Geod24 created dlang/dmd pull request #12225 "Fix 21659: Special enums are never forward referenced" fixing this issue:
- Fix 21659: Special enums are never forward referenced
The compiler always knows their property, so don't error out on special enums.
https://github.com/dlang/dmd/pull/12225
Comment #2 by dlang-bot — 2021-02-24T13:18:59Z
dlang/dmd pull request #12225 "Fix 21659: Special enums are never forward referenced" was merged into master:
- 86169b53a7a146a76c012a03f7a7f14a5fdcebb1 by Geod24:
Fix 21659: Special enums are never forward referenced
The compiler always knows their property, so don't error out on special enums.
https://github.com/dlang/dmd/pull/12225