Bug 11937 – Unresolved Symbol when template is instantiated as default value for function in another module
Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-16T08:40:00Z
Last change time
2014-01-24T23:39:07Z
Assigned to
nobody
Creator
blah38621
Comments
Comment #0 by blah38621 — 2014-01-16T08:40:39Z
I wish I could think of a shorter name for this, but oh well. This is an issue caused by one of the PRs merged within the last 24 hours. After reducing my codebase with dustmite, this is what I get:
--------------
Analyst.d:
import socket.io;
class Analyst
{
public:
Event!(void delegate()) Exit;
this()
{
this.Exit();
}}
--------------
event.d:
module std.event;
struct Event(OPTS...)
{
import std.functional ;
import std.traits ;
alias DelegateType = OPTS;
void opOpAssign(string op )(DelegateType )
{
}
static void rethrowExceptionHandler(DelegateType , Exception ) { }
auto opCall(ParameterTypeTuple!DelegateType , void delegate(DelegateType, Exception) = toDelegate(&rethrowExceptionHandler))
{
}
}
--------------
io.d: (not originally included in the dustmite process, running it again with this included now, will update this issue when that finishes.)
module socket.io;
import std.event : Event;
--------------
Yes, I know I'm triggering a different bug by doing that selective import of Event, but this appears to be a different issue.
Comment #1 by blah38621 — 2014-01-16T08:48:54Z
(In reply to comment #0)
> I wish I could think of a shorter name for this, but oh well. This is an issue
> caused by one of the PRs merged within the last 24 hours. After reducing my
> codebase with dustmite, this is what I get:
>
> --------------
> Analyst.d:
> import socket.io;
>
> class Analyst
> {
> public:
> Event!(void delegate()) Exit;
> this()
> {
> this.Exit();
> }}
> --------------
> event.d:
> module std.event;
>
> struct Event(OPTS...)
> {
> import std.functional ;
> import std.traits ;
>
> alias DelegateType = OPTS;
> void opOpAssign(string op )(DelegateType )
> {
> }
> static void rethrowExceptionHandler(DelegateType , Exception ) { }
> auto opCall(ParameterTypeTuple!DelegateType , void delegate(DelegateType,
> Exception) = toDelegate(&rethrowExceptionHandler))
> {
> }
> }
> --------------
> io.d: (not originally included in the dustmite process, running it again with
> this included now, will update this issue when that finishes.)
> module socket.io;
>
> import std.event : Event;
> --------------
>
>
> Yes, I know I'm triggering a different bug by doing that selective import of
> Event, but this appears to be a different issue.
Alright, finished reducing with io.d included, and the results are the same. The key to this however is that io.d must be only an include, it cannot be a source file of the build.
Comment #2 by k.hara.pg — 2014-01-16T17:21:42Z
Is this link-failure issue?
This report is not sufficient to reproduce errors. Please also post:
- Directory tree
- Command line
- Caused error messages
Comment #3 by blah38621 — 2014-01-17T05:38:52Z
(In reply to comment #2)
> Is this link-failure issue?
> This report is not sufficient to reproduce errors. Please also post:
>
> - Directory tree
> - Command line
> - Caused error messages
Well darn, I was afraid of that, alright, give me a bit to get a small version of the command line together, as it's currently just a little large. (it's a little over 2k characters as I passed it to dustmite, and I need to reduce the 400 line file that is io.d) And now that I re-read my report again, you are correct, I failed completely at saying what the actual issue is, woops. Yes, this is a link-failure issue, as it's unable to resolve the symbol for rethrowExceptionHandler in event.d.
Also, as I did a bit more investigating, it appears that the issue was likely caused in the merge of the 2.065 branch into master, as there are no other commits that changed anything that should have had any relation to template instantiation, however that commit shows no changes, so I have no idea how that's actually possible. This commit is the one I am currently using that builds (https://github.com/D-Programming-Language/dmd/commit/df5b5365fbccb9c571ccce7cc43232e4f49b646c), I haven't done more investigation to see which commit actually caused the issue.
Comment #4 by bugzilla — 2014-01-24T22:13:18Z
I'm going to mark this as invalid while awaiting a clear description of the problem. Also, does this happen with HEAD? Link failures with template instantiations can often be mitigated by using the -allinst switch to dmd.
Comment #5 by k.hara.pg — 2014-01-24T23:39:07Z
Recently merged my PR might have changed the status.
https://github.com/D-Programming-Language/dmd/pull/3103
I had intended also to implement more strict propagation of "template instantiation scope" in the PR. If you have interest, you can test the change with git-head dmd.