From: Nadav Har'El <n...@scylladb.com> Committer: Nadav Har'El <n...@scylladb.com> Branch: master
Remove redundant template name from method definition When defining a method and especially a constructor in a templated class c<T>, there is no need to use the "<T>" to "disambiguate" the name of the method or constructors. This "disambiguation" syntax used to work but was outlawed in C++20 (see https://stackoverflow.com/questions/63513984) and doesn't compile with gcc 14.1.1, giving the error: include/lockfree/queue-mpsc.hh:39:19: error: template-id not allowed for constructor in C++20 [-Werror=template-id-cdtor] 39 | linked_item<T>() : value(), next(nullptr) { } This patch removes the unnecessary "disambiguations" and fixes a part of the build on gcc 14.1.1 (e.g., on Fedora 40). There are other problems too, which will be solved in the following patches. Signed-off-by: Nadav Har'El <n...@scylladb.com> --- diff --git a/include/lockfree/queue-mpsc.hh b/include/lockfree/queue-mpsc.hh --- a/include/lockfree/queue-mpsc.hh +++ b/include/lockfree/queue-mpsc.hh @@ -36,8 +36,8 @@ class linked_item { public: T value; linked_item<T> *next; - linked_item<T>() : value(), next(nullptr) { } - explicit linked_item<T>(T val) : value(val), next(nullptr) { } + linked_item() : value(), next(nullptr) { } + explicit linked_item(T val) : value(val), next(nullptr) { } }; // LT can be any type that has an "LT *next" field, which we used to hold a @@ -48,7 +48,7 @@ private: std::atomic<LT*> pushlist; std::atomic<LT*> poplist; public: - constexpr queue_mpsc<LT>() : pushlist(nullptr), poplist(nullptr) { } + constexpr queue_mpsc() : pushlist(nullptr), poplist(nullptr) { } class iterator; diff --git a/include/lockfree/unordered-queue-mpsc.hh b/include/lockfree/unordered-queue-mpsc.hh --- a/include/lockfree/unordered-queue-mpsc.hh +++ b/include/lockfree/unordered-queue-mpsc.hh @@ -27,7 +27,7 @@ private: std::atomic<LT*> _head CACHELINE_ALIGNED; LT* _poll_list CACHELINE_ALIGNED; public: - constexpr unordered_queue_mpsc<LT>() + constexpr unordered_queue_mpsc() : _head(nullptr) , _poll_list(nullptr) { -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000cc9473061bf469f8%40google.com.