Bug 20079 – [2.087.0] Forward declaration of functions defined in mixin templates don't compile

Status
RESOLVED
Resolution
WONTFIX
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2019-07-24T02:06:51Z
Last change time
2022-03-25T11:06:57Z
Assigned to
No Owner
Creator
Ethan Watson

Attachments

IDFilenameSummaryContent-TypeSize
1757file_20079.txtCode exampletext/plain332

Comments

Comment #0 by gooberman — 2019-07-24T02:06:51Z
This is one of two issues that I believe have been harassing me all day, night, and early morning with mixins. Forward declare a function in an object. Mixin an implementation. Try to call it. Unresolved symbol.
Comment #1 by gooberman — 2019-07-24T02:07:30Z
Created attachment 1757 Code example
Comment #2 by look.at.me.pee.please — 2020-03-20T12:48:24Z
This isn't a bug, it is intended behavior. A mixin shouldn't overwrite a function in that way. Mixins aren't macros, they have limitations so that it doesn't unexpectedly change the meaning of something else. Just don't include the forward declare. But something tells me you want to have that behavior, such that forward declare would link to an external C++ function or something, unless that mixin defines the function of the body. It would then link to the D version?
Comment #3 by razvan.nitu1305 — 2022-03-25T11:06:57Z
Yes, as jacob has mentioned this is intended behavior.