-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Problem
Projects that compile with strict warning flags (-Wold-style-cast -Wuseless-cast -Werror) cannot include concurrentqueue.h, blockingconcurrentqueue.h, or lightweightsemaphore.h without errors on GCC 14/15 with C++17/20/23.
This is a common configuration for modern C++ codebases following strict coding standards.
Reproduction
#include "concurrentqueue.h"
#include "blockingconcurrentqueue.h"
int main() {
moodycamel::BlockingConcurrentQueue<int> q;
q.enqueue(42);
int item;
q.wait_dequeue_timed(item, std::chrono::milliseconds(1));
return 0;
}g++ -std=c++23 -Wall -Wextra -Wpedantic -Werror -Wold-style-cast -Wuseless-cast \
test.cpp -o test -lpthreadResult: 20+ errors from C-style casts across the three headers.
Affected locations
lightweightsemaphore.h: C-style casts(time_t),(long),(std::uint64_t),(int)intimed_wait,waitWithPartialSpinning,waitManyWithPartialSpinning,signalblockingconcurrentqueue.h: C-style casts(int),(size_t),(ssize_t),(LightweightSemaphore::ssize_t),(BlockingConcurrentQueue*)across constructors,enqueue_bulk,try_enqueue_bulk,try_dequeue_bulk,wait_dequeue_bulk,wait_dequeue_bulk_timed,size_approxconcurrentqueue.h:-Wuseless-castonstatic_cast<size_t>inhash_thread_id(cast is needed for 32-bit cross-platform correctness but redundant on 64-bit)
Environment
- GCC 14.2.0, GCC 15.2.0
- C++17, C++20, C++23
- Linux x86_64
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels