D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 662 - Allow UFCS for basic types and enums
Summary: Allow UFCS for basic types and enums
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: Walter Bright
URL:
Keywords:
Depends on: 6277
Blocks:
  Show dependency treegraph
 
Reported: 2006-12-07 04:22 UTC by Nazo Humei
Modified: 2015-06-09 05:14 UTC (History)
2 users (show)

See Also:


Attachments
patch (1.42 KB, patch)
2006-12-07 04:23 UTC, Nazo Humei
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Nazo Humei 2006-12-07 04:22:42 UTC
module prop;
import std.stdio,std.string;
enum Etest{
  a,b,c,d
}

typedef int testi = 10;
typedef Test Test2;

void main(){
  assert(22 .toString() == "22");
  assert((new Test).test(11)==11);
  assert(Test.test(11)==11);
  assert(Test2.test(11)==11);
  assert(test()==33);
  assert(prop.test()==33);
  assert(Etest.d.test()==Etest.d);
  testi i;
  assert(i.test()==i.init);
}

int test(){return 33;};

class Test{
  static int test(int i){return i;};
}

int test(Etest test){
  return cast(int)test;
}

int test(testi i){
  return cast(int)i;
}
Comment 1 Nazo Humei 2006-12-07 04:23:46 UTC
Created attachment 82 [details]
patch
Comment 2 Kenji Hara 2012-04-13 22:46:36 UTC
UFCS for all basic types and enums is implemented in dmd 2.059.