[Issue 7802] New: UFCS functions get lost when type is transmitted to template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 30 23:09:41 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7802
Summary: UFCS functions get lost when type is transmitted to
template
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bugzilla at digitalmars.com
--- Comment #0 from Walter Bright <bugzilla at digitalmars.com> 2012-03-30 23:10:11 PDT ---
a.d
-------------
void foo(T)(T t) {
t.func();
}
-------------
test.d
-------------
class C { }
void func(C c) { }
void test(C c) {
foo(c);
-------------
This fails to compile because a.d doesn't know about test.func(C c), and so
does not find it when attempting to resolve t.func() using UFCS.
The solution is to:
If func() is not found as a member function of t, then look in the template
instantiation scope for a func(t). If found, use that as the UFCS function, and
then mark the template instantiation as LOCAL to the instantiation context.
This will ensure that the mangled name of the instantiation will not conflict
with other instantiations of foo(T) with other func(T) functions.
--
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