Bug 17330 – [REG 2.072] BigInt's constructor used to be pure
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-04-18T13:11:43Z
Last change time
2018-01-05T13:28:22Z
Assigned to
Jack Stouffer
Creator
ag0aep6g
Comments
Comment #0 by ag0aep6g — 2017-04-18T13:11:43Z
Found by Russel Winder who posted to D.learn:
http://forum.dlang.org/post/[email protected]
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.