[Issue 8265] New: Pseudo member function not found when called across modules
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 19 05:24:16 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8265
Summary: Pseudo member function not found when called across
modules
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: tommitissari at hotmail.com
--- Comment #0 from Tommi <tommitissari at hotmail.com> 2012-06-19 05:26:34 PDT ---
// File: main.d
module main;
import test;
struct MyStruct
{
int _value;
int memberGetValue()
{
return _value;
}
}
int nonMemberGetValue(MyStruct ms)
{
return ms._value;
}
int main(string[] argv)
{
static assert(test.memberTest(MyStruct(42))); // #0: OK
static assert(MyStruct(42).nonMemberGetValue() == 42); // #1: OK
static assert(test.nonMemberTest(MyStruct(42))); // #2
return 0;
}
//...
// File: test.d
module test;
bool memberTest(T)(T t)
{
return t.memberGetValue() == 42;
}
bool nonMemberTest(T)(T t)
{
return t.nonMemberGetValue() == 42; // #3
}
// #2: Error: template instance test.nonMemberTest!(MyStruct)
// error instantiating
// #3: Error: undefined identifier 'nonMemberGetValue'
--
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