www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17330] New: [REG 2.072] BigInt's constructor used to be pure

https://issues.dlang.org/show_bug.cgi?id=17330

          Issue ID: 17330
           Summary: [REG 2.072] BigInt's constructor used to be pure
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

Found by Russel Winder who posted to D.learn:
http://forum.dlang.org/post/mailman.1458.1491584811.31550.digitalmars-d-learn puremagic.com

This used to work, and it should be made to work again:

----
void main()
{
    import std.bigint: BigInt;
    auto b = immutable BigInt("123");
}
----

Fails compilation since 2.072.0. Regression was introduced by
<https://github.com/dlang/phobos/pull/3876>.

The issue is that purity cannot be inferred for the constructor. It used to be
explicitly marked `pure` when it wasn't a template.

I've previously filed this as a compiler bug, thinking that a templated
constructor should infer `pure`. That issue has been closed as WONTFIX. See
issue 17309.

I'm not sure if this can be fixed satisfactorily. So this may end up as WONTFIX
as well. But that would be quite disappointing.

--
Apr 18 2017