www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10997] New: Tupple parsing(?)

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

           Summary: Tupple parsing(?)
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: a401989 drdrb.com



These two code snippets should be equivalent:

(http://dpaste.dzfl.pl/092d6296)
-----------------------------
import std.typecons;

struct Point {
  int x, y, z;

  Tuple!(string, Point) foo() {
    return tuple("foo", this);
  }
}

void main() {}
-----------------------------
http://dpaste.dzfl.pl/44e95825
-----------------------------
import std.typecons;

alias Tuple!(string, Point) DirPoint;

struct Point {
  int x, y, z;

  DirPoint foo() {
    return tuple("foo", this);
  }
}

void main() {}
-----------------------------

Alas later one fails horribly with
/d954/f796.d(3): Error: alias f796.DirPoint recursive alias declaration 
/opt/compilers/dmd2git/include/std/range.d(611): Error: static assert "Cannot
put a char[] into a Appender!(string)" 
/opt/compilers/dmd2git/include/std/format.d(1436): instantiated from here:
put!(Appender!(string), char[]) 
/opt/compilers/dmd2git/include/std/format.d(1338): instantiated from here:
formatUnsigned!(Appender!(string), char) 
/opt/compilers/dmd2git/include/std/format.d(1312): instantiated from here:
formatIntegral!(Appender!(string), ulong, char) 
/opt/compilers/dmd2git/include/std/format.d(2953): ... (3 instantiations, -v to
show) ... 
/opt/compilers/dmd2git/include/std/typecons.d(326): instantiated from here:
format!(char, ulong,ulong) 
/d954/f796.d(3): instantiated from here: Tuple!(string, Point)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2013