Thread overview
[Issue 18534] Wrong code for ?: operator when compiling with -O
Feb 27, 2018
ag0aep6g@gmail.com
Mar 19, 2018
Walter Bright
February 27, 2018
https://issues.dlang.org/show_bug.cgi?id=18534

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--
February 27, 2018
https://issues.dlang.org/show_bug.cgi?id=18534

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g@gmail.com

--- Comment #1 from ag0aep6g@gmail.com ---
Reduced Phobos away:

----
void f(char x) {}
void foo(int invert)
{
    char c = invert ? 'A' : 'A';
    f(c);
    assert(c == 'A'); // assertion fails
}
void main()
{
    foo(0);
}
----

--
February 27, 2018
https://issues.dlang.org/show_bug.cgi?id=18534

--- Comment #2 from hsteoh@quickfur.ath.cx ---
Reduced code without Phobos/template dependency:
-----
auto blah(char ch) { return ch; }
auto foo(int i)
{
    return blah(i ? 'A' : 'A');
}
void main()
{
    auto c = foo(0);
    assert(c == 'A');
}
-----

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

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/dlang/dmd/pull/8052

--
March 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18534

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/f9ed34003d9b0f533a37850540b02929586e7a76 fix Issue 18534 - Wrong code for ?: operator when compiling with -O

https://github.com/dlang/dmd/commit/cf2d493f07c1a8ae935d1ed9cded1666d3addbd2 Merge pull request #8052 from WalterBright/fix18534

fix Issue 18534 - Wrong code for ?: operator when compiling with -O

--
March 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18534

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--