On Thu, Oct 23, 2014 at 10:50 AM, Roy Stogner <royst...@ices.utexas.edu> wrote: > > On Thu, 23 Oct 2014, John Peterson wrote: > >> We came across this issue in one of our applications with clang 3.5.0. >> The following code compiles just fine in "C++03" mode, but fails in >> "C++11" mode. Is clang right here, or is it a compiler bug? > > > http://www.cplusplus.com/reference/ios/ios/operator_bool/ > > So in C++11, there should be an implicit conversion to bool *if* the > conversion gets forced by the return type. (if you use "auto" then > operator= just tries to copy the stream which IIRC isn't allowed) > > In C++03 the conversion is to void*, but I suppose the compiler is > figuring out that it can do a chain of conversions by then going from > void* to bool? I forger under what circumstances that's allowed. > > The version as-is should be working in C++11, I believe.
OK, so you are saying this code > bool t = (is >> val); is legal? (FWIW, it works with g++ -std=c++11) > I wouldn't swear that this was a compiler bug, though: you're mixing > clang with libstdc++, right? This could be another one of those > "libstdc++ tries to detect internal gcc preprocessor tokens and gets > confused by clang" bugs. I'm using the vendor version of clang++ provided by Apple. I presume that they build and use clang's libc++ due to their GPL aversion, but I wouldn't bet money on it. -- John ------------------------------------------------------------------------------ _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel