Issue 20079 - [2.087.0] Forward declaration of functions defined in mixin templates don't compile
Summary: [2.087.0] Forward declaration of functions defined in mixin templates don't c...
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P1 blocker
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-24 02:06 UTC by Ethan Watson
Modified: 2022-03-25 11:06 UTC (History)
2 users (show)

See Also:


Attachments
Code example (332 bytes, text/plain)
2019-07-24 02:07 UTC, Ethan Watson
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Ethan Watson 2019-07-24 02:06:51 UTC
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 Ethan Watson 2019-07-24 02:07:30 UTC
Created attachment 1757 [details]
Code example
Comment 2 jacob 2020-03-20 12:48:24 UTC
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 RazvanN 2022-03-25 11:06:57 UTC
Yes, as jacob has mentioned this is intended behavior.