www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17712] New: [REG 2.074] [LINK] Undefined reference to

https://issues.dlang.org/show_bug.cgi?id=17712

          Issue ID: 17712
           Summary: [REG 2.074] [LINK] Undefined reference to
                    std.conv.toChars!(10, char, 1, uint).toChars(uint)
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Reduced test (with two selective imports).
---
struct Bytecode
{
    uint data;
}

 trusted ctSub(U)(string format, U args)
{
    import std.conv : to;
    foreach (i; format)
        return  format~ to!string(args);
    return format;
}

struct CtContext
{
    import std.uni : CodepointSet;

    CodepointSet[] charsets;

    string ctAtomCode(Bytecode[] ir)
    {
        string code;
        switch (code)
        {
            OrChar:
                code ~=  ``;
                for (uint i ; i ;)
                    code ~= ctSub(``, ir[i].data);
                charsets[ir[0].data].toSourceCode;
                break;

            default:
                assert(0);
        }
        return code;
    }
}
---

Causes link error.
---
backtracking.o: In function
`_D3std4conv17__T6toImplTAyaTkZ6toImplFNaNbNekkE3std5ascii10LetterCaseZAya':
__main.d:(.text._D3std4conv17__T6toImplTAyaTkZ6toImplFNaNbNekkE3std5ascii10LetterCaseZAya+0x5e):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6Result'
backtracking.o: In function
`_D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZAa':
__main.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZAa+0xd):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6Result6lengthMFNaNbNdNiNfZm'
__main.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZAa+0x4f):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6Result5emptyMFNaNbNdNiNfZb'
__main.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZAa+0x5c):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6Result5frontMFNaNbNdNiNfZa'
__main.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6ResultZAa+0x9f):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TkZ7toCharsFNaNbNiNfkZ6Result8popFrontMFNaNbNiNfZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
---

Prettified.
---
backtracking.o: In function `std.conv.toImpl!(immutable(char)[],
uint).toImpl(uint, uint, std.ascii.LetterCase)':
__main.d:(0x5e): undefined reference to `std.conv.toChars!(10, char, 1,
uint).toChars(uint)'
backtracking.o: In function `std.array.array!(std.conv.toChars!(10, char, 1,
uint).toChars(uint).Result).array(std.conv.toChars!(10, char, 1,
uint).toChars(uint).Result)':
__main.d:(0xd): undefined reference to `std.conv.toChars!(10, char, 1,
uint).toChars(uint).Result.length()'
__main.d:(0x4f): undefined reference to `std.conv.toChars!(10, char, 1,
uint).toChars(uint).Result.empty()'
__main.d:(0x5c): undefined reference to `std.conv.toChars!(10, char, 1,
uint).toChars(uint).Result.front()'
__main.d:(0x9f): undefined reference to `std.conv.toChars!(10, char, 1,
uint).toChars(uint).Result.popFront()'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
---


Does not happen with 2.073.
---
$ dmd-2073 backtracking.d -v 2>&1 | grep toChars.Result.popFront
function  std.conv.toChars!(10, char, cast(LetterCase)true,
uint).toChars.Result.popFront
function  std.conv.toChars!(16, char, cast(LetterCase)false,
uint).toChars.Result.popFront
function  std.conv.toChars!(16, char, cast(LetterCase)true,
uint).toChars.Result.popFront
function  std.conv.toChars!(2, char, cast(LetterCase)true,
uint).toChars.Result.popFront
function  std.conv.toChars!(8, char, cast(LetterCase)true,
uint).toChars.Result.popFront

$ dmd-2074 backtracking.d -v 2>&1 | grep toChars.Result.popFront
function  std.conv.toChars!(16, char, cast(LetterCase)false,
uint).toChars.Result.popFront
function  std.conv.toChars!(16, char, cast(LetterCase)true,
uint).toChars.Result.popFront
function  std.conv.toChars!(2, char, cast(LetterCase)true,
uint).toChars.Result.popFront
function  std.conv.toChars!(8, char, cast(LetterCase)true,
uint).toChars.Result.popFront
---

However when testing with gdc, all I updated was the library, and managed to
reproduce the same thing, so a change in phobos exposed this.

--
Aug 03