[Issue 10506] Purity should not be checked in a mixin statement
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 1 06:00:49 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10506
monarchdodra at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |monarchdodra at gmail.com
--- Comment #5 from monarchdodra at gmail.com 2013-07-01 06:00:47 PDT ---
(In reply to comment #4)
> (In reply to comment #3)
> > This is issue 6169, which was fixed a while ago. I don't know what compiler
> > version you were using but I double-checked the source and it calls
> > ctfeSemantic like it should.
> >
> > *** This issue has been marked as a duplicate of issue 6169 ***
>
> Let's try this:
>
> -----
> import std.string;
>
> void test() pure
> {
> mixin(["int ", "x;"].join());
> }
>
> void main() {}
> -----
>
> 2.061: ok
> 2.062: Error: pure function 'test' cannot call impure function 'join'
> 2.063: Error: pure function 'test' cannot call impure function 'join'
> 2.064: ok (but I think this is because join has become pure?)
>
> Note that the test-case in Issue 6169 works in all of these compilers, but not
> the sample I gave.
I have reopened 6169 with this usecase:
--------
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.
--------
Not sure if this is strictly 6169 or if I should have posted here and
un-resolved as duplicate. But in any case, this is (I think) a simpler use
case.
--
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