Thread overview
[Issue 11937] New: Unresolved Symbol when template is instantiated as default value for function in another module
Jan 16, 2014
Orvid King
Jan 16, 2014
Orvid King
Jan 17, 2014
Kenji Hara
Jan 17, 2014
Orvid King
Jan 25, 2014
Walter Bright
Jan 25, 2014
Kenji Hara
January 16, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11937

           Summary: Unresolved Symbol when template is instantiated as
                    default value for function in another module
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: blah38621@gmail.com


--- Comment #0 from Orvid King <blah38621@gmail.com> 2014-01-16 08:40:39 PST ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 16, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11937



--- Comment #1 from Orvid King <blah38621@gmail.com> 2014-01-16 08:48:54 PST ---
(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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 17, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11937



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2014-01-16 17:21:42 PST ---
Is this link-failure issue?
This report is not sufficient to reproduce errors. Please also post:

- Directory tree
- Command line
- Caused error messages

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 17, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11937



--- Comment #3 from Orvid King <blah38621@gmail.com> 2014-01-17 05:38:52 PST ---
(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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 25, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11937


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |INVALID


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2014-01-24 22:13:18 PST ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 25, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11937



--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2014-01-24 23:39:07 PST ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------