www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9004] New: Wrong line number for undefined identifier error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9004

           Summary: Wrong line number for undefined identifier error
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2012-11-12 05:12:35 PST ---
This is probably wrong code:


struct Foo(_T) {
    alias _T T;
}
void bar(FooT)(FooT foo, FooT.T x) {
}
void main() {
    Foo!int foo;
    bar(foo, 1); // line 8
}


DMD 2.061alpha gives:

test.d(8): Error: undefined identifier FooT.T
test.d(8): Error: template test.bar does not match any function template
declaration
test.d(8): Error: template test.bar(FooT) cannot deduce template function from
argument types !()(Foo!(int),int)

Note the line number where the "undefined identifier FooT.T" error is.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9004


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-11-12
06:24:11 PST ---
I don't think this is wrong code though.. You can declare `FooT.T x;` inside
the function body, I don't see why it shouldn't be allowed in the function
header.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9004


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2012-11-13 04:20:53 PST ---
https://github.com/D-Programming-Language/dmd/pull/1283

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 13 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9004



--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2012-11-13 04:40:46 PST ---
(In reply to comment #1)
 I don't think this is wrong code though.. You can declare `FooT.T x;` inside
 the function body, I don't see why it shouldn't be allowed in the function
 header.

If a part of function parameter type is a template parameter, as like `FooT.T`, it doesn't work in current IFTI mechanism. D has a proper module system, so its working would be worth. But it is yet an enhancement request. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 13 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9004



--- Comment #4 from github-bugzilla puremagic.com 2012-11-13 14:04:55 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d3595e31c087ca44e2f55d3267318ba8e176078e
fix Issue 9004 - Wrong line number for undefined identifier error

https://github.com/D-Programming-Language/dmd/commit/39a7788e5463c8b88b3ccc897795fd3978036137
Merge pull request #1283 from 9rnsr/fix9004

Issue 9004 - Wrong line number for undefined identifier error

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 13 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9004


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: -------
Nov 13 2012