[Issue 7636] New: const hole for implicit conversion to base class
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 3 16:17:22 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7636
Summary: const hole for implicit conversion to base class
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dawg at dawgfoto.de
--- Comment #0 from dawg at dawgfoto.de 2012-03-03 16:17:19 PST ---
class Base
{
int _val;
}
class Foo : Base
{
Base base() const { return this; }
}
void main()
{
const(Foo) foo = new const(Foo);
static assert(!__traits(compiles, foo._val = 1));
static assert(!__traits(compiles, foo.base()._val = 1));
foo.base()._val = 1;
assert(foo._val == 0);
}
Also broken for immutable and shared.
--------
This is probably implemented as 'return cast(Base)this;' and
needs to include the right modifiers.
--
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