[Issue 5747] cannot cast away shared if opCast defined
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 13 01:33:59 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=5747
Basile-z <b2.temp at gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
CC| |b2.temp at gmx.com
Resolution|--- |WORKSFORME
--- Comment #11 from Basile-z <b2.temp at gmx.com> ---
This issue is quite old and i don't see the limitation you talked about:
---
struct S
{
int* p;
T opCast(T)() const
{
static if (is(T == S))
return cast() this;
static if (is(T == const(S)))
return cast(const) this;
}
}
void main()
{
const (S) s;
auto b = cast(S)(s);
auto c = cast(const)(b);
auto d = cast(const(S))(b);
}
---
Maybe cast() didn't exist at this time ?
--
More information about the Digitalmars-d-bugs
mailing list