[Issue 2154] static if (is(typeof(E.toString()) : string)) in template broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 7 16:35:34 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2154





------- Comment #1 from 2korden at 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.


-- 



More information about the Digitalmars-d-bugs mailing list