Thread overview
[Issue 18267] Linker errors compiling std_data_json dub package with dmd 2.078.0
Jan 24, 2018
John Colvin
Jan 25, 2018
anonymous4
Jan 25, 2018
Atila Neves
[Issue 18267] array comparison broken in 2.078.3
Feb 22, 2018
John Colvin
Apr 27, 2018
Mike Franklin
Nov 02, 2021
RazvanN
Nov 02, 2021
John Colvin
Aug 23
RazvanN
January 24, 2018
https://issues.dlang.org/show_bug.cgi?id=18267

John Colvin <john.loughran.colvin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin@gmail.
                   |                            |com
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|major                       |regression

--
January 25, 2018
https://issues.dlang.org/show_bug.cgi?id=18267

--- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> ---
opEquals changes attributes based on debug switch? What if it's marked as @safe?

--
January 25, 2018
https://issues.dlang.org/show_bug.cgi?id=18267

--- Comment #2 from Atila Neves <atila.neves@gmail.com> ---
If it's marked as `@safe` then `pure` is still an issue. At least with the very reduced example. I think the specifics depend on the code being compiled.

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

John Colvin <john.loughran.colvin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry
            Summary|Linker errors compiling     |array comparison broken in
                   |std_data_json dub package   |2.078.3
                   |with dmd 2.078.0            |

--- Comment #3 from John Colvin <john.loughran.colvin@gmail.com> ---
Here is a standalone file that demonstrates what I think is a symptom of the same bug:

% cat oops.d
struct JSONValue
{
    TaggedAlgebraic payload;
    alias payload this;
}

struct TaggedAlgebraic
{
    auto opEquals(T)(T other) const
    {
        static assert(is(typeof(performOp!(JSONValue[], T))));
        return const(JSONValue[]).init == other;
    }
}

bool performOp(T, A)(T value, A arg)
{
    return value == arg;
}

% dmd oops.d
Undefined symbols for architecture x86_64:
  "_D6object__T8__equalsTxS4oops9JSONValueTxQsZQBgFNbAxQBdQfZb", referenced
from:
      _D4oops15TaggedAlgebraic__T8opEqualsTAxSQBm9JSONValueZQBbMxFQxZb in
oops.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

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

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slavo5150@yahoo.com

--- Comment #4 from Mike Franklin <slavo5150@yahoo.com> ---
Attributing `opEquals` with `nothrow` resolves the linker error:

struct S
{
    P payload;
    alias payload this;
}

struct P
{
    auto opEquals(T)(T other) const nothrow  //*** Needs nothrow ***/
    {
        static assert(is(typeof(performOp!(S[], T))));
        return const(S[]).init == other;
    }
}

bool performOp(T, A)(T value, A arg)
{
    return value == arg;
}

--
April 01, 2019
https://issues.dlang.org/show_bug.cgi?id=18267

feklushkin.denis@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |feklushkin.denis@gmail.com

--
April 01, 2019
https://issues.dlang.org/show_bug.cgi?id=18267

feklushkin.denis@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|feklushkin.denis@gmail.com  |

--
November 02, 2021
https://issues.dlang.org/show_bug.cgi?id=18267

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |FIXED

--- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> ---
This seems to have been fix as I cannot reproduce the example provided by John Colvin.

--
November 02, 2021
https://issues.dlang.org/show_bug.cgi?id=18267

John Colvin <john.loughran.colvin@gmail.com> changed:

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

--- Comment #6 from John Colvin <john.loughran.colvin@gmail.com> ---
Atila's original example still fails with dmd master

--
August 23
https://issues.dlang.org/show_bug.cgi?id=18267

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #7 from RazvanN <razvan.nitu1305@gmail.com> ---
@Atilla I have just tried your initial example and it compiles fine with the latest version of master.

What I did:

For the following files:
=================================
// app.d
void main() { import oops; }
=================================
// oops.d
<attached file>
struct Location {
    string file;
}


struct JSONValue {
    union PayloadUnion {
        JSONValue[] array;
    }

    alias Payload = TaggedAlgebraic!PayloadUnion;

    Payload payload;
    Location location;

    alias payload this;
}


struct TaggedAlgebraic(U)
....
========================

Commands:

% dmd -g -c oops.d
% dmd -g -debug app.d oops.o

I get a binary. So this seems to have been fixed. I am going to preemptively close as WORKSFORME, but please reopen if I'm missing something.

--