https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96266

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Michal Malecki from comment #0)
> I'm attaching a quite long preprocessed file, but all "simplified examples"
> didn't reproduce it.

Of course they do. This has nothing to do with macros or parentheses.


#include <iostream>

enum SRT_EPOLL_OPT
{
   SRT_EPOLL_UPDATE = 0x10,
};

inline bool operator&(int flags, SRT_EPOLL_OPT eflg)
{
    return (flags & int(eflg)) != 0;
}

using namespace std;

int main() {

    int evts = 0x11;

    int et_evts = (evts & SRT_EPOLL_UPDATE);

 cout << (SRT_EPOLL_UPDATE) << " " << et_evts << " " << evts << endl;
}


As Jakub said, your operator& is used here and is doing exactly what you told
it to do, returning a bool.

Reply via email to