Bug 23468 – [betterC] Cannot use std.array.join and std.algorithm.map at compile-time

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-11-06T22:53:35Z
Last change time
2024-12-13T19:25:30Z
Keywords
betterC
Assigned to
No Owner
Creator
Matthew O
Moved to GitHub: dmd#20180 →

Comments

Comment #0 by moconnor — 2022-11-06T22:53:35Z
It looks like certain aspects of CTFE are disabled when building with -betterC. I assume this is a bug? ``` struct Vector2 { int x, y; } extern(C) void main() { import std.algorithm : map; import std.range : join; import std.traits : FieldNameTuple; enum fragment = [FieldNameTuple!Vector2].map!(field => "0.").join(","); Vector2 zero = mixin("Vector2(" ~ fragment ~ ")"); } ``` When compiled with `dmd -betterC betterc.exe .\betterc.d`, I get: ``` .\betterc.d(9): Error: none of the overloads of template `std.array.join` are callable using argument types `!()(MapResult!(__lambda1, string[]), string)` dmd\current\windows\bin64\..\..\src\phobos\std\array.d(2125): Candidates are: `join(RoR, R)(RoR ror, R sep)` with `RoR = MapResult!(__lambda1, string[]), R = string` must satisfy the following constraint: ` isInputRange!(Unqual!(ElementType!RoR))` dmd\current\windows\bin64\..\..\src\phobos\std\array.d(2228): `join(RoR, E)(RoR ror, scope E sep)` with `RoR = MapResult!(__lambda1, string[]), E = string` must satisfy the following constraint: ` isInputRange!(Unqual!(ElementType!RoR))` dmd\current\windows\bin64\..\..\src\phobos\std\array.d(2321): `join(RoR)(RoR ror)` ```
Comment #1 by robert.schadek — 2024-12-13T19:25:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20180 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB