Just looked online and stdlibc++ has this at the top the mutex header: https://gcc.gnu.org/onlinedocs/gcc-4.9.3/libstdc++/api/a01070_source.html
#if __cplusplus < 201103L # include <bits/c++0x_warning.h> #else Shouldn't we perform the same sort of check? On Tue, Mar 1, 2016 at 8:57 AM, don hinton <hinto...@gmail.com> wrote: > That's a good point. Since mutex is a new c++11 feature, why is it > injected into the std namespace when not compiling with c++11. I looked at > the mutex header, and it doesn't test current value of __cplusplus. > > Should it? > > On Mon, Feb 29, 2016 at 3:07 PM, Jim Porter via cfe-users < > cfe-users@lists.llvm.org> wrote: > >> On 2/29/2016 12:15 PM, Brian Cole via cfe-users wrote: >> >>> Was hoping for something that would be C++03 compatible as well since we >>> still have C++03 compilers to target as well. >>> >> >> If you're #including <mutex>, haven't you locked yourself into C++11 (or >> better) anyway? In that case, you should use curly braces for your >> initializer (or at least stop saying `using namespace std;`). >> >> For existing code where `mutex` is a global variable, you'll be fine. If >> you add >> >> #include <mutex> >> using namespace std; >> >> to existing code, you'll get a compiler error because the name `mutex` is >> now ambiguous. >> >> If you wanted to warn about this in *all* cases, you'd need an additional >> warning to detect function declarations in local scope, since that's what >> C++ would treat this as. Clang doesn't have such a warning, but perhaps you >> could convince someone to add it. >> >> - Jim >> >> >> >> _______________________________________________ >> cfe-users mailing list >> cfe-users@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users >> > >
_______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users