[Issue 5747] cannot cast away shared if opCast defined
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 12 23:36:01 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=5747
--- Comment #10 from monarchdodra at gmail.com 2013-12-12 23:35:57 PST ---
(In reply to comment #9)
> (In reply to comment #7)
> >
> > Your example snippet still overflows for me for the initial use case:
>
> It doesn't with dmd 2.064.
Are you sure you don't mean HEAD? Head is the only version for me that doesn't
horribly die for me.
~/D$ ./HEAD/dmd/src/dmd -run main.d
~/D$ ./RELEASE/dmd.2.064.2/linux/bin64/dmd -run main.d
--- killed by signal 11
~/D$ ./RELEASE/dmd.2.064/linux/bin64/dmd -run main.d
--- killed by signal 11
~/D$ ./RELEASE/dmd.2.063.2/linux/bin64/dmd -run main.d
--- killed by signal 11
~/D$ ./RELEASE/dmd.2.063/linux/bin64/dmd -run main.d
--- killed by signal 11
> But that's irrelevant. As I said, it is trivial to avoid recursion
If "T" is anything *but* const, I really don't see how you'd do anything
*other* than infinitely recurse.
T opCast(T)() const
if (is(Unqual!T == S))
{
static if (is(T == const))
return this;
else
//Not const: Try harder?
return cast(T)this;
}
> contrary to your claim that it is impossible.
It *might* be possible (which is still yet to be proven), but it isn't
tirivial.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list