From 59b893b176ccfe25b6211f8150a32d36af9e3e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 6 Aug 2026 11:25:47 +0200 Subject: [PATCH] Fix Clang's -Wunused-template warning better. As was the case in Corrade, this was due to an extra `static`. Except for the warning in the snippet file, where I don't see any other way how to suppress it. This partially reverts commit b8bddc438c3544692f2015b82499b7508ff32d3d. --- doc/snippets/SceneGraph.cpp | 3 ++- src/Magnum/Math/FunctionsBatch.h | 18 +++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/doc/snippets/SceneGraph.cpp b/doc/snippets/SceneGraph.cpp index 42a81ea09..212e9b5df 100644 --- a/doc/snippets/SceneGraph.cpp +++ b/doc/snippets/SceneGraph.cpp @@ -147,7 +147,8 @@ class CachingObject: public Object3D, SceneGraph::AbstractFeature3D { namespace { /* Clang 23 adds -Wunused-template to -Wall and then warns about the unused - constructor. Well, this is a doc snippet, so what am I supposed to do? */ + (template) constructor. Well, this is a doc snippet, so what am I supposed + to do? */ #ifdef CORRADE_TARGET_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-template" diff --git a/src/Magnum/Math/FunctionsBatch.h b/src/Magnum/Math/FunctionsBatch.h index 83bcd3abd..3b35e3244 100644 --- a/src/Magnum/Math/FunctionsBatch.h +++ b/src/Magnum/Math/FunctionsBatch.h @@ -49,21 +49,9 @@ namespace Implementation { /** @todo Utility/Algorithms.h has a similar (but different) variant of this, maybe turn that into some public utility once we have one more use case? */ -/* Clang since version 23 includes -Wunused-template in -Wall, and warns for - those declarations. The templates are used inside a decltype() expression - below (and commenting them out obviously makes the test fail to compile) so - this is yet another completely pointless warning that just wastes my - time. */ -#ifdef CORRADE_TARGET_CLANG -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-template" -#endif -template::type>::from(std::declval()))> static auto stridedArrayViewTypeFor(T&&) -> typename std::remove_const::type; -template static typename std::remove_const::type stridedArrayViewTypeFor(const Containers::ArrayView&); -template static typename std::remove_const::type stridedArrayViewTypeFor(const Containers::StridedArrayView1D&); -#ifdef CORRADE_TARGET_CLANG -#pragma clang diagnostic pop -#endif +template::type>::from(std::declval()))> auto stridedArrayViewTypeFor(T&&) -> typename std::remove_const::type; +template typename std::remove_const::type stridedArrayViewTypeFor(const Containers::ArrayView&); +template typename std::remove_const::type stridedArrayViewTypeFor(const Containers::StridedArrayView1D&); }