[Issue 17716] wrong result of IsExpression when not in static assert
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 19 15:26:13 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=17716
er.krali at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |er.krali at gmail.com
--- Comment #2 from er.krali at gmail.com ---
Furthermore, it doesn't work with ref parameters either:
---
struct S {
int i;
}
void fun(ref S s, int i) {
s.i = i;
}
void main() {
shared S s;
/* This fails:
onlineapp.d(17): Error: function onlineapp.fun(ref S s, int i) is not
callable using argument types (S, int)
onlineapp.d(17): cannot pass rvalue argument cast(S)s of type S
to parameter ref S s
fun(cast(S) s, 1);
*/
(*(cast (S*) &s)).fun(1); // Nasty workaround
assert (s.i == 1);
}
---
I also can't understand why the workaround works at all, the result of
dereferencing a pointer should surely be a rvalue?
Is that also a bug?
--
More information about the Digitalmars-d-bugs
mailing list