D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3159 - Can't access member variables from templated nested member function
Summary: Can't access member variables from templated nested member function
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2009-07-09 10:28 UTC by David Simcha
Modified: 2015-06-09 01:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-07-09 10:28:19 UTC
struct Foo {
    uint number;

    void doStuff(uint num) {

        void doMoreStuff(T)(T num2) {
            number++;
        }

        doMoreStuff(num);
    }
}

test.d(7): Error: need 'this' to access member number

Also happens if Foo is a class instead of a struct.  Does not happen if doMoreStuff() is a plain old function instead of a function template.
Comment 1 Kenji Hara 2012-06-06 05:00:45 UTC
Works in 2.060head.