digitalmars.D.bugs - [Issue 2154] New: static if (is(typeof(E.toString()) : string)) in template broken
- d-bugmail puremagic.com (37/37) Jun 18 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2154
- d-bugmail puremagic.com (17/17) Aug 07 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2154
- d-bugmail puremagic.com (4/4) Aug 07 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2154
- d-bugmail puremagic.com (12/14) Nov 24 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2154
- d-bugmail puremagic.com (12/12) Sep 04 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2154
http://d.puremagic.com/issues/show_bug.cgi?id=2154 Summary: static if (is(typeof(E.toString()) : string)) in template broken Product: D Version: 2.014 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: someanon yahoo.com This code works fine with v2.013. Both v2.014, v2.015 now errors out. BTW, is there another way to write this code? thanks. $ cat temp.d class V(E) { E[2] data; public /*override*/ string toString() { static if (is(typeof(E.toString()) : string)) { // error line! return ""; } else { string str = ""; return str; } } } class A { public string toString() { return ""; } } typedef V!(A) VA; $ dmd -c temp.d Error: this for toString needs to be type A not type temp.V!(A).V --
Jun 18 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2154 Not sure if it is a bug or not. You are trying to access a non-static method. Try one of these solutions: 1) Make the method static: class A { public static string toString() { return ""; } } 2) change your test code: ... static if (is(typeof((new E()).toString()) : string)) { ... Both work for me. Let someone more knowledgeable decide whether we need to close the issue. --
Aug 07 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2154 *** Bug 2274 has been marked as a duplicate of this bug. *** --
Aug 07 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2154 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com Severity|normal |regression Keywords| |rejects-validNot sure if it is a bug or not. You are trying to access a non-static method. Try one of these solutions:It is, because the very design of IsExpression is that semantic analysis errors never escape it, but instead cause the IsExpression to evaluate to false. --
Nov 24 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2154 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED This works now. Not sure when it was fixed, but it was 2.022 or earlier. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 04 2009