public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/109108] New: d: Undefined reference to lambda in private enum
@ 2023-03-12 14:52 ibuclaw at gcc dot gnu.org
  2023-03-14 18:16 ` [Bug d/109108] " cvs-commit at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ibuclaw at gcc dot gnu.org @ 2023-03-12 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109108
           Summary: d: Undefined reference to lambda in private enum
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gcc dot gnu.org
  Target Milestone: ---

Similar to pr108055.  Lambdas should be emitted in every module they are
referenced from.

```
import other;
void main()
{
    auto a = callFun(1);
}
```

```
private enum int function(ref int)[] funs =
[
    0: (ref idx) => 0,
    1: (ref idx) => 1,
];

int callFun(I)(I idx)
{
    return funs[idx](idx);
}
```

Only compiling the "main" module results in linker errors.
---
$ gdc test.d -Wl,--demangle=dlang
/usr/x86_64-pc-linux-gnu/bin/ld: /tmp/ccDW8iNw.o: in function
`other.callFun!(int).callFun(int)':
test.d:(.text+0x4b): undefined reference to
`other.__lambda4!(int).__lambda4(ref int)'
test.d:(.text+0x56): undefined reference to
`other.__lambda5!(int).__lambda5(ref int)'
collect2: error: ld returned 1 exit status

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-14 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-12 14:52 [Bug d/109108] New: d: Undefined reference to lambda in private enum ibuclaw at gcc dot gnu.org
2023-03-14 18:16 ` [Bug d/109108] " cvs-commit at gcc dot gnu.org
2023-03-14 19:11 ` cvs-commit at gcc dot gnu.org
2023-03-14 19:55 ` cvs-commit at gcc dot gnu.org
2023-03-14 20:18 ` ibuclaw at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).