--- Comment #5 from Jerry Quinn <> 2012-01-17 06:42:58 PST 
(In reply to comment #4)
> Neither int (outside the range [0,1]) nor RegexMatch implicitly convert to
> bool. Negating counts as an explicit cast to bool.

As far as I can tell, RegexMatch does implicitly cast to bool.

struct RegexMatch {
  T opCast(T : bool);

I could be missing something, but this effectively declares an opCast!bool
operator. claims that
both ! and bare references will get rewritten to opCast!bool:

  if (e)   =>  if (e.opCast!(bool))
  if (!e)  =>  if (!e.opCast!(bool))

That should take care of the return, no?

Note that the same compile failure happens if I write:

  auto re = regex("test");
  if (match("test", re)) { ... }

It strikes me that the language docs are rather sparse on defining what can and
cannot be implicitly converted.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to