Thread overview |
---|
June 18, 2008 [Issue 2154] New: static if (is(typeof(E.toString()) : string)) in template broken | ||||
---|---|---|---|---|
| ||||
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 -- |
August 07, 2008 [Issue 2154] static if (is(typeof(E.toString()) : string)) in template broken | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2154 ------- Comment #1 from 2korden@gmail.com 2008-08-07 18:35 ------- 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. -- |
August 07, 2008 [Issue 2154] static if (is(typeof(E.toString()) : string)) in template broken | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2154 ------- Comment #2 from 2korden@gmail.com 2008-08-07 18:51 ------- *** Bug 2274 has been marked as a duplicate of this bug. *** -- |
November 24, 2008 [Issue 2154] static if (is(typeof(E.toString()) : string)) in template broken | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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-valid ------- Comment #3 from smjg@iname.com 2008-11-24 06:21 ------- (In reply to comment #1) > Not 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. -- |
September 04, 2009 [Issue 2154] static if (is(typeof(E.toString()) : string)) in template broken | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 --- Comment #4 from Don <clugdbug@yahoo.com.au> 2009-09-04 03:03:43 PDT --- 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: ------- |
Copyright © 1999-2021 by the D Language Foundation