[Issue 8446] New: Can't use 'this' pointer in pure member function?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jul 26 13:53:26 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8446
Summary: Can't use 'this' pointer in pure member function?
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dmitry.olsh at gmail.com
--- Comment #0 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2012-07-26 13:53:25 PDT ---
A test case, probably can be reduced futher:
@trusted public struct RleBitSet(T)
{
public:
@property auto byInterval() pure const
{
static struct IntervalRange
{
this(in RleBitSet set_)
{
}
}
return IntervalRange(this);
}
}
immutable set = RleBitSet!(uint).init;
pure void func()
{
auto x = set.byInterval;
}
Tested on DMD 2.060 beta. Compiler flags seem to have no effect.
Output:
bug.d(14): Error: pure function 'byInterval' cannot call impure function 'this'
--
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