For some reason, it seems like expressions of the form "foo.bar !in baz" aren't allowed. I suspect this is a grammar/parser problem -- the bang is interpreted as a template argument operator, rather than a negation operator, and there's really no need to make that interpretation when it is immediately followed by "in". This suspicion is strengthened by the fact that "bar !in baz" is fine, as is "(foo.bar) !in baz".

Should I file this as a bug?

Small sample program:

struct Foo {
   uint bar;
}

struct Baz {
   bool opIn_r(uint e) {
       return false;
   }
}

void main() {
   Baz baz;
   Foo foo;
   auto res = (foo.bar) !in baz;
   res = !(foo.bar in baz);
   // res = foo.bar !in baz; // Not OK...
   uint frozz;
   res = frozz !in baz;
}

--
Magnus Lie Hetland
http://hetland.org

Reply via email to