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

Java sticky instances of class com.mysql.jdbc.Field aggregating -