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


Steven Schveighoffer <schvei...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schvei...@yahoo.com


--- Comment #1 from Steven Schveighoffer <schvei...@yahoo.com> 2011-06-02 
21:27:28 PDT ---
Hm... I'm not so sure this is a valid requirement.

&& shortcuts *running* the code if the first test fails, but it doesn't
shortcut *compiling* the code.  I think you need to use a static if in this
case.

For example, I'd expect this also to fail to compile:

void main()
{
   int x;

   if(is(typeof(x) == string) && x == "5") {}
}

But I'd expect this to work:

void main()
{
   int x;

   static if(is(typeof(x) == string))
     if(x == "5") {}
}

I would expect something like this to work in your example instead:

static if(is(typeof(pred) : string))
   enum defaultPred = (pred == "a == b");
else
   enum defaultPred = false;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to