D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10997 - Tupple parsing(?)
Summary: Tupple parsing(?)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-08 08:52 UTC by Shoo
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Shoo 2013-09-08 08:52:57 UTC
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)