Thread overview
[Issue 17716] wrong result of IsExpression when not in static assert
Aug 03, 2017
ag0aep6g@gmail.com
Sep 19, 2018
er.krali@gmail.com
Sep 19, 2018
ag0aep6g
Sep 19, 2018
er.krali@gmail.com
Dec 17, 2022
Iain Buclaw
August 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17716

--- Comment #1 from ag0aep6g@gmail.com ---
Inside functions everything works as expected:

----
struct S { shared int* foo; int* bar; }
pragma(msg, is(shared S : S)); /* "true" - wrong */
void f()
{
    pragma(msg, is(shared S : S)); /* "false" - correct */
}
----

--
September 19, 2018
https://issues.dlang.org/show_bug.cgi?id=17716

er.krali@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |er.krali@gmail.com

--- Comment #2 from er.krali@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?

--
September 19, 2018
https://issues.dlang.org/show_bug.cgi?id=17716

--- Comment #3 from ag0aep6g <ag0aep6g@gmail.com> ---
(In reply to er.krali from comment #2)
> Furthermore, it doesn't work with ref parameters either:
[...]

You made the same comment on issue 17729, and it makes more sense there. I guess you posted it here by accident?

--
September 19, 2018
https://issues.dlang.org/show_bug.cgi?id=17716

--- Comment #4 from er.krali@gmail.com ---
(In reply to ag0aep6g from comment #3)
> 
> You made the same comment on issue 17729, and it makes more sense there. I guess you posted it here by accident?

Yes I did, I didn't notice that bugzilla had moved to the "next" bug and I thought it hadn't been posted. If there's a way to remove it (and this comment, if needed), please do, I don't think I can do it myself.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=17716

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=17716

--- Comment #5 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19295

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--