c++ - explicit operator bool not called inside lambda — MSVC bug? -


#include <functional>  struct t {     explicit operator bool() { return true; } };  int main() {     t t;      if(t) {} // ok      auto l = [&]() {         if (t) {} // error     }; } 

msvc's behaviour seems oddly inconsistent here; difference between ok line , error line 1 in lambda. bug?

is bug?

yes, definitely. there nothing wrong in program, bool conversion operator shall invoked in both cases.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -