D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21347 - std.functional.adjoin should work in BetterC
Summary: std.functional.adjoin should work in BetterC
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-10-29 02:10 UTC by Paul Backus
Modified: 2020-10-29 03:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Paul Backus 2020-10-29 02:10:44 UTC
Example program:

---
extern(C) int main()
{
    import std.functional: adjoin;

    alias f = (int n) => n + 1;
    alias g = (int n) => n + 2;
    alias h = (int n) => n + 3;
    alias i = (int n) => n + 4;

    auto result = adjoin!(f, g, h, i)(0);

    assert(result[0] == 1);
    assert(result[1] == 2);
    assert(result[2] == 3);
    assert(result[3] == 4);

    return 0;
}
---

Compiler output:

---
$ dmd -betterC bug.d
/usr/include/dmd/phobos/std/array.d(3243): Error: TypeInfo cannot be used with -betterC
$ dmd --version
DMD64 D Compiler v2.094.0
---

Note that due to details of the current implementation, only calls to adjoin with 4 or more template arguments are affected as of Phobos 2.094.0.
Comment 1 Dlang Bot 2020-10-29 03:01:57 UTC
@pbackus created dlang/phobos pull request #7686 "Fix issue 21347 - std.functional.adjoin should work in BetterC" fixing this issue:

- Fix issue 21347 - std.functional.adjoin should work in BetterC

https://github.com/dlang/phobos/pull/7686
Comment 2 Dlang Bot 2020-10-29 03:45:21 UTC
dlang/phobos pull request #7686 "Fix issue 21347 - std.functional.adjoin should work in BetterC" was merged into master:

- 8719a5fb9e3f455bff29a7aba0cb9aad5ae50b57 by Paul Backus:
  Fix issue 21347 - std.functional.adjoin should work in BetterC

https://github.com/dlang/phobos/pull/7686