www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8780] New: std.traits.ReturnType of overloaded functions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8780

           Summary: std.traits.ReturnType of overloaded functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: luka8088 owave.net



module program;

import std.stdio;
import std.traits;

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

void main () {

  ReturnType!(f1) v1;

  writeln(typeid(typeof(v1))); // int
                               // chould this lead to unexpected behavior ?

}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8780




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: -------
Oct 08 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8780




I am sorry for such bad description but it seems to me that there are multiple
bugs here and I am not sure where the problem is - or even if there is one.
Free free to provide a better description =)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8780


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |verylonglogin.reg gmail.com



11:35:25 MSK ---
This is because of Issue 7549. Not a duplicate as library have to workaround
compiler bugs and work correct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 15 2012