D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5525 - Eponymous templates should allow for overloaded eponymous members
Summary: Eponymous templates should allow for overloaded eponymous members
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2011-02-04 14:22 UTC by Simen Kjaeraas
Modified: 2012-03-08 22:54 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Simen Kjaeraas 2011-02-04 14:22:21 UTC
Given:

template foo( T ) {
    T foo( T t ) {
        return t;
    }
    T foo( T t, T u ) {
        return t + u;
    }
}

This should not cause problems. Basically, if a template contains an eponymous overload set, the overload set should be considered its only member.
Comment 1 Andrej Mitrovic 2012-01-20 17:39:26 UTC
I think a recent fix enables templates with multiple members to still be used as eponymous templates, but I don't recall the Issue number..
Comment 2 Kenji Hara 2012-02-22 04:28:11 UTC
In dmd2.058, eponymous template hides internal names (fixing bug 4675).
But eponymous overload set isn't still allowed.

Workaround:

template foo( T ) {
    T foox( T t ) {
        return t;
    }
    T foox( T t, T u ) {
        return t + u;
    }
    alias foox foo;  // bundle overloads as eponymous member.
}
Comment 4 github-bugzilla 2012-02-22 11:43:41 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/207e93a5f061e82f18ed7b0f21ea844ef1fec9cf
fix Issue 5525 - Eponymous templates should allow for overloaded eponymous members

https://github.com/D-Programming-Language/dmd/commit/3fa6179603c0b6a57b0baccd40bc2f6155255d0a
Merge pull request #758 from 9rnsr/fix5525

Issue 5525 - Eponymous templates should allow for overloaded eponymous members