www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13300] New: pure function

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

          Issue ID: 13300
           Summary: pure function
                    'std.array.Appender!(T[]).Appender.ensureAddable'
                    cannot call impure function 'test.T.__fieldPostBlit'
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

////////// test.d //////////
import std.array;
import std.variant;

alias Algebraic!bool Value;

struct T
{
    Value value;
     disable this();
}

void main()
{
    auto a = appender!(T[]);
}
////////////////////////////

Compiler output:

C:\...\std\array.d(2400,34): Error: pure function
'std.array.Appender!(T[]).Appender.ensureAddable' cannot call impure function
'test.T.__fieldPostBlit'
C:\...\std\array.d(2729,1): Error: template instance std.array.Appender!(T[])
error instantiating
test.d(14,11):        instantiated from here: appender!(T[])

Introduced in https://github.com/D-Programming-Language/phobos/pull/2147

--
Aug 15 2014