[Issue 8780] std.traits.ReturnType of overloaded functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 8 04:02:03 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8780



--- Comment #1 from luka8088 <luka8088 at owave.net> 2012-10-08 03:44:04 PDT ---
module program;

import std.stdio;
import std.traits;

class a {}
class b {}

int f1 (a o) { return 1; }
string f1 (b o) { return "2"; }

void main () {
  a a1 = new a();
  b b1 = new b();

  writeln(a1.f1()); // 1
  writeln(b1.f1()); // 2

  typeof(a1.f1()) v1; // int
  typeof(b1.f1()) v2; // string

  ReturnType!(a1.f1) v2; // Error: no property 'f1' for type 'program.a'
                         // Error: ReturnType!(__error) is used as a type

}

-- 
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