Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gRPC auth_context.h using std::iterator produces deprecated warning with latest VC++ compiler

Tags:

c++

grpc

Compiling one of my projects that uses gRPC with the latest Visual Studio 2019 16.5 preview 2 compiler gives rise to this warning:

1>D:\...\grpcpp\impl\codegen\security\auth_context.h(38,19): warning C4996: 'std::iterator<std::input_iterator_tag,const grpc::AuthProperty,ptrdiff_t,const grpc::AuthProperty *,const grpc::AuthProperty &>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

Before submitting a bug report, I thought I've check here if the gRPC developers are already aware of this?

like image 337
David Lowndes Avatar asked Sep 13 '25 09:09

David Lowndes


1 Answers

gRPC is currently dependant on Absel that is reliant on C++11. You should avoid using two different C++ standards in your applications to avoid template incompatibilities. There is a longer discussion on Absel C++11 vs C++17 versions here: https://github.com/abseil/abseil-cpp/issues/259.

You can check out the Absel pages for more details at https://github.com/abseil/abseil-cpp.

like image 145
Clifford Wichmann Avatar answered Sep 14 '25 23:09

Clifford Wichmann