March 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962



--- Comment #38 from Don <clugdbug@yahoo.com.au> 2012-03-23 01:48:04 PDT ---
(In reply to comment #36)
> cat > a.d << CODE
> import b;
> alias foo!() fooi;
> CODE
> 
> cat > b.d << CODE
> void foo()(int p)
> {
>     int inner()() { return p; }
>     alias inner!() finner;
> }
> CODE
> 
> dmd -c b a
> 
> --------
> 
> Slightly more reduced test case.
> 
> There are two things that should get fixed.
> 
> - We push template instances into the wrong object/module.
>   The module a template instance is attached to is found
>   by following the importedFrom chain. The head of the chain
>   should be the template declaration module not the instantiation
>   module. By doing so we guarantee that all instances remain
>   ordered and are bundled with their dependencies.

It's interesting how closely related that issue is to this one I posted
yesterday:
https://github.com/D-Programming-Language/dmd/pull/824
Fundamentally we need to sort out which module owns a function. I'm not sure
where the code belongs.

> 
> - VarDeclaration::toSymbol creates csym lazily.
>   I don't see any reason why this shouldn't apply to
>   parameters as well, e.g. replacing the 'p' parameter
>   with a local variable fixes the bug. So we should
>   just call v->toSymbol() and remove the assertion.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962



--- Comment #39 from github-bugzilla@puremagic.com 2012-04-25 16:27:25 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d5a33a1cbeedec2ea65ba480636caaf78ca05117
fix Issue 2962 - ICE(glue.c) or bad codegen passing variable as template value
parameter

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962



--- Comment #40 from github-bugzilla@puremagic.com 2012-04-25 16:27:51 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/900c537038932435eaebdf7c0f80926e0bd8f2f5
fix Issue 2962 - ICE(glue.c) or bad codegen passing variable as template value
parameter

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962


Walter Bright <bugzilla@digitalmars.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962



--- Comment #41 from github-bugzilla@puremagic.com 2012-05-03 11:55:14 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/816219255151628cfc2a8dc279f603420b7d9312 Test cases for bug 2962 ICE(glue.c) with variable as template value parameter

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962


jens.k.mueller@gmx.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |jens.k.mueller@gmx.de
         Resolution|FIXED                       |


--- Comment #42 from jens.k.mueller@gmx.de 2012-08-17 14:05:39 PDT ---
The following code (two modules) shows that this bug is not fixed yet.

module foo;

void baz(alias pred)()
{
    pred(0);
}

---

module bar;

import foo;

void bar(int id)
{
    baz!((a)
    {
        id = 0; // passing a delegate as template argument does not allow
                // accessing its environment
    })();
}

dmd foo.d bar.d
results in:
bar.d(5): Error: function bar.bar compiler error, parameter 'id', bugzilla
2962?
dmd: glue.c:717: virtual void FuncDeclaration::toObjFile(int): Assertion `0'
failed.

Unfortunately I couldn't reduce the test case any further. If the delegate has
no parameter I cannot reproduce the compiler assertion failure. And of course
if id is not accessed from within the delegate the problem goes away. This is
at the core of the problem.
As pointed out in the comments the specified order of files is important. I.e.
dmd bar.d foo.d compiles just fine.

I used DMD64 D Compiler v2.060.
I'm reopening this bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962


tmn <tmn.dbugs@mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tmn.dbugs@mailinator.com


--- Comment #43 from tmn <tmn.dbugs@mailinator.com> 2012-11-08 05:24:57 PST ---
Using a local variable inside the delegate instead of a parameter of the calling function results in incorrect code:

----------------
module b;
auto call(alias fun)() {
    return fun(0);
}
----------------
module a;
import b;
import std.stdio;
void main() {
    int x = 1;
    writeln(call!(a => x));    // should print the value of x
}
----------------

$ dmd b.d a.d -ofa && ./a
-771364480


(Using DMD64 D Compiler v2.060 on Linux)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2962


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #44 from Don <clugdbug@yahoo.com.au> 2012-12-12 03:47:58 PST ---
Comments 42 and 43 refer to an entirely different bug. The test cases in those comments were fixed by today's fix to bug 6395.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=2962



--- Comment #45 from github-bugzilla@puremagic.com 2013-08-27 13:20:09 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ba0b1d73fff98be1440d972fa88bb730d136b10c Add fail_compilation test for bug 2962

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2 3 4 5
Next ›   Last »