denik added a comment. We are hitting the warning in template code with bool and loop like this: "for (const auto& element : value)" where element is bool from template. But not always. When it is bool the warning triggers: error: loop variable 'element' is always a copy because the range of type 'const std::vector<bool, allocator<bool> >' does not return a reference [-Werror,-Wrange-loop-analysis]
However, the template type can also use non-bools and if I remove the reference I hit alternative case where the warning complains about copy operation of reference types: error: loop variable 'element' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Werror,-Wrange-loop-analysis] for (const auto element : value): use reference type 'const std::__1::tuple<unsigned int, bool, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > &' to prevent copying So there is no way to satisfy the warning other than disabling it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68912/new/ https://reviews.llvm.org/D68912 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits