https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106563

            Bug ID: 106563
           Summary: [12/13 Regression] d: undefined reference to
                    pragma(inline) symbol
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Compiled with `gdc test.d` results in:
/usr/bin/ld: /tmp/ccxf3O8c.o: in function
`stdx.math.nextPow2!(ulong).nextPow2(const(ulong))':
test.d:(.text+0x6d): undefined reference to
`stdx.math.powIntegralImpl!(const(ulong)).powIntegralImpl(const(ulong))'
collect2: error: ld returned 1 exit status

Because the function is pragma(inline), it should receive automatic codegen
during the front-end -> GCC tree lowering pass.

---
module stdx.math;

T nextPow2(T)(const T val)
{
    return powIntegralImpl(val);
}

pragma(inline, true)
T powIntegralImpl(T)(T)
{
    return 1;
}
---
module stdx.regex;
import stdx.uni;

struct CharMatcher
{
    typeof(MultiArray!().length) trie;
}
---
module stdx.uni;

struct MultiArray()
{
    @property length()
    {
        return spaceFor!0();
    }
}

size_t spaceFor(size_t bits)()
{
    import stdx.math;
    return nextPow2(bits);
}
---
module test;
import stdx.math;
import stdx.regex;

void requireSize()(size_t size)
{
    nextPow2(size);
}

void main()
{
    requireSize(0);
}

Reply via email to