https://issues.dlang.org/show_bug.cgi?id=16500
Issue ID: 16500
Summary: inferred != annotated pure
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
struct X(T)
{
this(S)(in S[] arr) // inferred pure
{ }
}
void main() pure
{
X!uint mut = [ 1, 2 ]; // proves inference (cf. main is pure)
// immutable X!uint imm1 = [ 1, 2 ];
// auto imm2 = immutable X!uint([1, 2]);
}
The last lines don't compile. However, they do if the inferred pure is
explicitly annotated.
>From the discussion
https://forum.dlang.org/post/[email protected]
--