mfontanini / cppkafka

Modern C++ Apache Kafka client library (wrapper for librdkafka)
BSD 2-Clause "Simplified" License
587 stars 207 forks source link

warning: object backing the pointer will be destroyed at the end of the full-expression #313

Open middlenebel opened 6 months ago

middlenebel commented 6 months ago

Hello, I found this warning compiling into a Dockerfile:

[ 75%] Building CXX object src/CMakeFiles/cppkafka.dir/producer.cpp.o /app/cppkafka/src/producer.cpp:154:54: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl] RD_KAFKA_V_TOPIC(message.get_topic().data()), ^~~~~~~ /usr/include/librdkafka/rdkafka.h:1152:60: note: expanded from macro 'RD_KAFKA_V_TOPIC' _LRK_TYPECHECK(RD_KAFKA_VTYPE_TOPIC, const char *, topic), \ ^~~~~ /usr/include/librdkafka/rdkafka.h:115:47: note: expanded from macro '_LRK_TYPECHECK' TYPE __t RD_UNUSED = (ARG); \ ^~~ 1 warning generated.

Edit:

It was because of the Catch2 submodule, because I did a recursive update. With the current version in cppkafka it does not give that warning.