C\C++ Bitwise operation with constant issue : This is one of the weirdest things I've encountered. My problem is this:

First of all, I'm using Visual Studio 2015 on Windows 7. In a C++\CLI project, I have code similar tho the following:

<!-- language: c++ -->

    void Class::function(int flag) 
    {
       if ((flag & CONST) != 0)
           printf("Passed.");
       else 
           printf("Failed.");
    }

Where `CONST` is defined in another (Non-CLR) DLL to be `0x111`. Looks pretty straight-forward. The problem I've had is that when I entered the procedure where `flag` is equal to `0x40`. To me, it looks as if this procedure should print `Failed.`, when in fact it it printed `Passed.`. The next thing I did, was to alter my code to the following:


<!-- language: c++ -->

    void Class::function(int flag) 
    {
       int local = CONST, localRes = flag & local, res;
       if ((res = (flag & CONST)) != 0)
           printf("Passed.");
       else 
           printf("Failed.");
    }

Now, breaking the execution on `printf`, I got the following values in the Watch:

    res = 0x110
    local = 0x111
    localRes = 0x0

I could not watch the value of `CONST` though VS didn't didn't know it in that context.  

As far as I'm concerned, I could get around this by using `local`, but I'd rather understand it. Could someone please tell me what's wrong with the compilation/execution?
Thanks!