danvratil / qcoro

C++ Coroutines for Qt
https://qcoro.dvratil.cz
MIT License
331 stars 53 forks source link

0.6.0 build fails because of -Werror #94

Closed antonio-rojas closed 2 years ago

antonio-rojas commented 2 years ago
/build/qcoro/src/qcoro-0.6.0/qcoro/core/qcorosignal.h: In function ‘operator()’:
/build/qcoro/src/qcoro-0.6.0/qcoro/core/qcorosignal.h:225:14: error: ‘MEM[(struct QArrayDataPointer *)&result + 8B].d’ may be used uninitialized [-Werror=maybe-uninitialized]
  225 |         auto result = std::move(mQueue.front());
      |              ^
/build/qcoro/src/qcoro-0.6.0/qcoro/core/qcorosignal.h:225:14: error: ‘MEM[(struct QArrayDataPointer *)&result + 8B].ptr’ may be used uninitialized [-Werror=maybe-uninitialized]

Please don't use -Werror in released code. Even if it works for you, it may break when using a different compiler or a different version of the same compiler, and it will surely break with future compiler versions, so you're artificially setting an expiration date on your code.

danvratil commented 2 years ago

Indeed, my fault and thanks for reporting this. I've moved all the -Wall -Wextra -Werror -pedantic flags to Debug build only (#95).

Just out of curiosity, which compiler (and version) did you encounter this on?

antonio-rojas commented 2 years ago

Thanks. This was with GCC 12.1 (only in the Qt6 build)