[Issue 6169] [CTFE] pure functions cannot compute constants using functions not marked as pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 1 00:39:37 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=6169


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


--- Comment #14 from monarchdodra at gmail.com 2013-07-01 00:39:34 PDT ---
Not fully fixed for @safe. The conditions to reproduce are a bit complicated
actually. It requires attribute inference, mixin and default args (!) I'm not
sure which it is that it producing the problem:

--------
string bar(string op = "+") @property
{
    return "a" ~ op ~ "b";
}

void foo()()
{
    int a, b;
    int c = mixin(bar);
}

@safe void main()
{
    foo!()();
}
--------
main.d(14): Error: safe function 'D main' cannot call system function
'main.foo!().foo'
--------

Observations:
1) The problem is only with @safe, not pure.
2) Calling "min(bar("+"))" also makes the problem go away.

Built with HEAD from 30-06-2013

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list