[Issue 7372] New: wrong error: undefined identifier

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 26 08:50:39 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7372

           Summary: wrong error: undefined identifier
           Product: D
           Version: D1
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: leandro.lucarella at sociomantic.com


--- Comment #0 from Leandro Lucarella <leandro.lucarella at sociomantic.com> 2012-01-26 08:50:37 PST ---
Test case:

m.d
---
import m2;
interface I {}
class C : I { mixin M!(I); }
---

m2.d
----
import m1;
template M (T)
{
    public void f()
    {
        bug(1); // line 6
    }
}
----

m1.d
----
template bug(T)
{
    void bug(T t) {}
}
----

$ dmd -c m.d
m2.d(6): Error: undefined identifier bug
m2.d(6): Error: function expected before (), not __error of type _error_

Aside from the second spurious error, "bug" symbol should be perfectly defined.

Moving any template function to another module fixes the problem. Using a
selective import (import m1 : bug;) also fails. Using the full name of the
symbol (m1.bug(1); using static import m1; or without static) produces this
error instead:

m2.d(6): Error: undefined identifier m1, did you mean module m?
m2.d(6): Error: function expected before (), not __error of type _error_

Adding an alias to m2.d like this: alias m1.bug bug; fixes the problem. So it
looks like the symbol is hidden to the template.

A git bisect show this commit as the one introducing the regression:
merge D2 pull 591 (93a643aba6f62db1b7658c2bfb51f9d0b576c337)

https://github.com/D-Programming-Language/dmd/commit/93a643aba6f62db1b7658c2bfb51f9d0b576c337
https://github.com/D-Programming-Language/dmd/pull/591

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


More information about the Digitalmars-d-bugs mailing list