Re: How to test for equality of types?

2012-05-20 Thread Philippe Sigaud
Using the current git version of dmd I realized that C works! Hence, as a workaround it can be used by creating a local alias A and subsequently using A.Alias in the is-expressions. But it seems odd that alias typeof(X).A B; does not work but alias typeof(X) Y; alias Y.A B; does. Is this

Re: How to test for equality of types?

2012-05-20 Thread Kenji Hara
On Saturday, 19 May 2012 at 18:17:16 UTC, Matthias Walter wrote: On 2012-05-19 15:28, Philippe Sigaud wrote: On Sat, May 19, 2012 at 12:23 PM, Matthias Walter xa...@xammy.homelinux.net wrote: I would open a bug report with the following code which is a bit smaller than my first wrong

Re: How to test for equality of types?

2012-05-20 Thread Kenji Hara
On Sunday, 20 May 2012 at 06:57:20 UTC, Kenji Hara wrote: On Saturday, 19 May 2012 at 18:17:16 UTC, Matthias Walter wrote: Using the current git version of dmd I realized that C works! Hence, as a workaround it can be used by creating a local alias A and subsequently using A.Alias in the

Re: How to test for equality of types?

2012-05-20 Thread Philippe Sigaud
-- 09:33, Kenji Hara k.hara...@gmail.com -- 08:57, Kenji Hara wrote: It seems to me that is a regression by fixing bug 6475. Now I'm trying to fix them. I've filed the bug in bugzilla: http://d.puremagic.com/issues/show_bug.cgi?id=8123 And posted a pull request to fix it:

Re: How to test for equality of types?

2012-05-20 Thread Kenji Hara
On Sunday, 20 May 2012 at 06:57:20 UTC, Kenji Hara wrote: On Saturday, 19 May 2012 at 18:17:16 UTC, Matthias Walter wrote: On 2012-05-19 15:28, Philippe Sigaud wrote: On Sat, May 19, 2012 at 12:23 PM, Matthias Walter xa...@xammy.homelinux.net wrote: I would open a bug report with the

Re: How to test for equality of types?

2012-05-19 Thread Philippe Sigaud
On Fri, May 18, 2012 at 11:51 PM, Simen Kjaeraas simen.kja...@gmail.com wrote: Because Wrapper!(AliasStruct).Wrap does not exist. And _error_ is not equal to any other type. Yes. Wrap is included in the complete template name (Wrapper!(Wrap)) and has no independent existence. You _can_ get

Re: How to test for equality of types?

2012-05-19 Thread Matthias Walter
On 2012-05-19 09:05, Philippe Sigaud wrote: On Fri, May 18, 2012 at 11:51 PM, Simen Kjaeraas simen.kja...@gmail.com wrote: Because Wrapper!(AliasStruct).Wrap does not exist. And _error_ is not equal to any other type. Yes. Wrap is included in the complete template name (Wrapper!(Wrap))

Re: How to test for equality of types?

2012-05-19 Thread Philippe Sigaud
On Sat, May 19, 2012 at 12:23 PM, Matthias Walter xa...@xammy.homelinux.net wrote: I would open a bug report with the following code which is a bit smaller than my first wrong version: = (...)  pragma(msg, typeof(w.aliasStruct).Alias.stringof); // - MyStruct  pragma(msg,

Re: How to test for equality of types?

2012-05-19 Thread Matthias Walter
On 2012-05-19 15:28, Philippe Sigaud wrote: On Sat, May 19, 2012 at 12:23 PM, Matthias Walter xa...@xammy.homelinux.net wrote: I would open a bug report with the following code which is a bit smaller than my first wrong version: = (...) pragma(msg,

How to test for equality of types?

2012-05-18 Thread Matthias Walter
Hi, how do I test two types for equality? Suppose I have A and B aliasing some type(s), how do I find out if they are aliases the same thing? I tried the is(A == B) expression, but this does not always work (tell me if I shall give an example). On the other hand, according to the spec the

Re: How to test for equality of types?

2012-05-18 Thread bearophile
Matthias Walter: I tried the is(A == B) expression, but this does not always work (tell me if I shall give an example). Showing examples is great. Bye, bearophile

Re: How to test for equality of types?

2012-05-18 Thread Steven Schveighoffer
On Fri, 18 May 2012 06:06:45 -0400, Matthias Walter xa...@xammy.homelinux.net wrote: Hi, how do I test two types for equality? Suppose I have A and B aliasing some type(s), how do I find out if they are aliases the same thing? I tried the is(A == B) expression, but this does not always work

Re: How to test for equality of types?

2012-05-18 Thread Matthias Walter
On 2012-05-18 16:12, Steven Schveighoffer wrote: On Fri, 18 May 2012 06:06:45 -0400, Matthias Walter wrote: how do I test two types for equality? Suppose I have A and B aliasing some type(s), how do I find out if they are aliases the same thing? I tried the is(A == B) expression, but this

Re: How to test for equality of types?

2012-05-18 Thread Simen Kjaeraas
On Fri, 18 May 2012 23:06:00 +0200, Matthias Walter xa...@xammy.homelinux.net wrote: [snip] prints out false Because Wrapper!(AliasStruct).Wrap does not exist. And _error_ is not equal to any other type. true Indeed, they are the same. false And here I disagree. This prints true

Re: How to test for equality of types?

2012-05-18 Thread Artur Skawina
On 05/18/12 23:06, Matthias Walter wrote: = struct MyStruct { } struct Wrapper(Wrap) { Wrap _wrap; this(Wrap wrap) { _wrap = wrap; } } struct AliasStruct { public: alias MyStruct Alias; } int main(char[][] args) { auto w =