Re: foreach on a tuple using aliases

2018-08-06 Thread Timon Gehr via Digitalmars-d-learn
On 06.08.2018 14:37, Steven Schveighoffer wrote: On 8/5/18 11:40 AM, Timon Gehr wrote: On 05.08.2018 16:07, Steven Schveighoffer wrote: So is this a bug? Is it expected? It's a bug. The two copies of 'item' are not supposed to be the same symbol. (Different types -> different symbols.) Yep

Re: foreach on a tuple using aliases

2018-08-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/5/18 11:40 AM, Timon Gehr wrote: On 05.08.2018 16:07, Steven Schveighoffer wrote: So is this a bug? Is it expected? It's a bug. The two copies of 'item' are not supposed to be the same symbol. (Different types -> different symbols.) Yep. I even found it has nothing to do with foreach o

Re: foreach on a tuple using aliases

2018-08-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/5/18 10:48 AM, Alex wrote: void main() {     Foo foo;     assert(isFoo!foo);     static struct X { int i; Foo foo; }     X x;     static foreach(i, item; typeof(x).tupleof)     static if(is(typeof(item) == Foo))  // line A     static assert(isFoo!item);  // line B    

Re: foreach on a tuple using aliases

2018-08-05 Thread Timon Gehr via Digitalmars-d-learn
On 05.08.2018 16:07, Steven Schveighoffer wrote: I have found something that looks like a bug to me, but also looks like it could simply be a limitation of the foreach construct. Consider this code: struct Foo {} enum isFoo(alias x) = is(typeof(x) == Foo); void main() {     Foo foo;     as

Re: foreach on a tuple using aliases

2018-08-05 Thread Alex via Digitalmars-d-learn
On Sunday, 5 August 2018 at 14:07:30 UTC, Steven Schveighoffer wrote: I have found something that looks like a bug to me, but also looks like it could simply be a limitation of the foreach construct. Consider this code: struct Foo {} enum isFoo(alias x) = is(typeof(x) == Foo); void main() {

foreach on a tuple using aliases

2018-08-05 Thread Steven Schveighoffer via Digitalmars-d-learn
I have found something that looks like a bug to me, but also looks like it could simply be a limitation of the foreach construct. Consider this code: struct Foo {} enum isFoo(alias x) = is(typeof(x) == Foo); void main() { Foo foo; assert(isFoo!foo); static struct X { int i; Foo fo