D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19883 - Cyclic constructor call for BigInt(dstring)
Summary: Cyclic constructor call for BigInt(dstring)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-05-18 14:29 UTC by Sophie
Modified: 2020-03-21 03:56 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 Sophie 2019-05-18 14:29:52 UTC
Expected behavior:

BigInt can be initialized with a string, wstring, or dstring.

Actual behavior:

Attempting to initialize BigInt (std.bigint) with a dstring produces an error.

Example repro case:

C:\D\dmd.2.081.2\dmd2\windows\bin\..\..\src\phobos\std\bigint.d(122): Error: cyclic constructor call
E:\...\test.d(3): Error: template instance `std.bigint.BigInt.__ctor!dstring` error instantiating

    void main() {
        import std.bigint;
        auto n = BigInt("1234"d);
    }
Comment 1 basile-z 2019-05-19 02:29:29 UTC
The problem is that byCodeUnit over dchar[] verifies isSomeString;

    import std.utf, std.traits;
    dchar[] t;
    static assert(!isSomeString!(typeof(t.byCodeUnit)));

So the other __ctor overload is never called.
Comment 2 Dlang Bot 2019-05-19 02:37:17 UTC
@Basile-z created dlang/phobos pull request #7017 "fix issue 19883 - Cyclic constructor call for BigInt(dstring)" fixing this issue:

- fix issue 19883 - Cyclic constructor call for BigInt(dstring)

https://github.com/dlang/phobos/pull/7017
Comment 3 Dlang Bot 2019-05-19 03:33:17 UTC
dlang/phobos pull request #7017 "fix issue 19883 - Cyclic constructor call for BigInt(dstring)" was merged into master:

- 7bf6a6d0d1e9a0f51b054265e115addea572ff98 by Basile Burg:
  fix issue 19883 - Cyclic constructor call for BigInt(dstring)

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