[flang-commits] [flang] [Flang][#212316] Fix -Wunused-template errors under -Werror (PR #218985)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Wed Sep 2 06:06:58 PDT 2026


================
@@ -75,11 +75,11 @@ getDataOperandBaseAddr(Fortran::lower::AbstractConverter &converter,
 
 namespace detail {
 template <typename T> //
-static T &&AsRvalueRef(T &&t) {
+T &&AsRvalueRef(T &&t) {
   return std::move(t);
 }
 template <typename T> //
-static T AsRvalueRef(T &t) {
+T AsRvalueRef(T &t) {
----------------
eugeneepshteyn wrote:

(AI comment)

Nit only — no change required. Picking these two overloads is exactly right: the third one (`const T &`, line 86) is left `static` because it genuinely *is* instantiated in every includer, so it never warned.

The side effect is that the trio now has mixed linkage, decided by which overload happened to trip the warning rather than by intent. Dropping `static` from line 86 as well would make it uniform, and would keep the warning from coming back on that one if the call site in `PeelConvert::visit_with_category` ever rebinds to a different overload.


https://github.com/llvm/llvm-project/pull/218985


More information about the flang-commits mailing list