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

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -