Skip to content

Error: unused function template 'operator()' with latest nightly Clang #6059

Closed

Description

@mstorsjo

Since a very recent change in Clang, llvm/llvm-project#208001, building Harfbuzz now fails like this:

[1/242] Compiling C++ object src/libharfbuzz.so.0.61421.0.p/hb-common.cc.o
FAILED: src/libharfbuzz.so.0.61421.0.p/hb-common.cc.o 
clang++ -Isrc/libharfbuzz.so.0.61421.0.p -Isrc -I../src -I. -I.. -I/usr/include/freetype2 -I/usr/include/libpng16 -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -fno-exceptions -std=c++11 -O2 -g -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -DHAVE_CONFIG_H -fPIC -pthread -MD -MQ src/libharfbuzz.so.0.61421.0.p/hb-common.cc.o -MF src/libharfbuzz.so.0.61421.0.p/hb-common.cc.o.d -o src/libharfbuzz.so.0.61421.0.p/hb-common.cc.o -c ../src/hb-common.cc
In file included from ../src/hb-common.cc:29:
In file included from ../src/hb.hh:561:
../src/hb-meta.hh:131:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
  131 |   operator () (T&& v) const HB_AUTO_RETURN (std::forward<T> (v))
      |   ^~~~~~~~
[... lots of more errors of the same kind ...]

Building with -DHB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR avoids the error (while this diagnostic still is printed as a warning).

Activity

  1. behdad commented on Jul 9, 2026

    @behdad
    Member

    This is quite annoying. I will silence it instead of changing the code.

  2. added a commit that references this issue on Jul 9, 2026
  3. stefson commented on Aug 7, 2026

    @stefson

    I hit this in firefox-153.0 when building with clang-23.1.0_rc2:

    335:57.96 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-meta.hh:140:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:57.99 E   140 |   operator () (hb::shared_ptr<T>& v) const HB_AUTO_RETURN (*v)
    335:57.99 E       |   ^~~~~~~~
    335:58.01 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-meta.hh:143:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.02 E   143 |   operator () (const hb::unique_ptr<T>& v) const HB_AUTO_RETURN (*v)
    335:58.02 E       |   ^~~~~~~~
    335:58.04 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-meta.hh:146:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.05 E   146 |   operator () (hb::unique_ptr<T>& v) const HB_AUTO_RETURN (*v)
    335:58.05 E       |   ^~~~~~~~
    335:58.10 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:386:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.11 E   386 |   operator () (T& v) const { return v; }
    335:58.12 E       |   ^~~~~~~~
    335:58.13 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:389:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.14 E   389 |   operator () (T&& v) const { return v; }
    335:58.15 E       |   ^~~~~~~~
    335:58.16 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:519:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.17 E   519 |   impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, (uint32_t) (v ^ (v >> 32)) * 2654435761u /* Knuth's multiplicative hash */)
    335:58.18 E       |   ^~~~
    335:58.19 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:526:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.21 E   526 |   impl (const T& v, hb_priority<0>) const HB_RETURN (uint32_t, std::hash<hb_decay<decltype (hb_deref (v))>>{} (hb_deref (v)))
    335:58.21 E       |   ^~~~
    335:58.23 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:744:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.24 E   744 |   impl (T1&& v1, T2 &&v2, hb_priority<2>) const HB_AUTO_RETURN
    335:58.24 E       |   ^~~~
    335:58.26 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:756:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.27 E   756 |   impl (T1&& v1, T2 &&v2, hb_priority<0>) const HB_AUTO_RETURN
    335:58.27 E       |   ^~~~
    335:58.29 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1500:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.29 E  1500 | { HB_PARTIALIZE(2);
    335:58.30 E       |   ^~~~~~~~~~~~~~~~
    335:58.31 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.32 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.33 E       |        ^~~~~~~~
    335:58.34 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1506:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.35 E  1506 | { HB_PARTIALIZE(2);
    335:58.36 E       |   ^~~~~~~~~~~~~~~~
    335:58.37 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.38 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.39 E       |        ^~~~~~~~
    335:58.40 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1512:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.41 E  1512 | { HB_PARTIALIZE(2);
    335:58.41 E       |   ^~~~~~~~~~~~~~~~
    335:58.42 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.43 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.44 E       |        ^~~~~~~~
    335:58.45 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1518:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.46 E  1518 | { HB_PARTIALIZE(2);
    335:58.48 E       |   ^~~~~~~~~~~~~~~~
    335:58.49 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.49 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.50 E       |        ^~~~~~~~
    335:58.51 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1524:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.52 E  1524 | { HB_PARTIALIZE(2);
    335:58.52 E       |   ^~~~~~~~~~~~~~~~
    335:58.53 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.54 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.55 E       |        ^~~~~~~~
    335:58.56 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1530:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.57 E  1530 | { HB_PARTIALIZE(2);
    335:58.57 E       |   ^~~~~~~~~~~~~~~~
    335:58.58 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.59 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.60 E       |        ^~~~~~~~
    335:58.61 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1532:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.62 E  1532 |   operator () (const T &a, const T &b) const HB_AUTO_RETURN (~a | b)
    335:58.62 E       |   ^~~~~~~~
    335:58.64 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1536:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.64 E  1536 | { HB_PARTIALIZE(2);
    335:58.65 E       |   ^~~~~~~~~~~~~~~~
    335:58.66 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.67 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.68 E       |        ^~~~~~~~
    335:58.69 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1538:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.70 E  1538 |   operator () (const T &a, const T &b) const HB_AUTO_RETURN (a | ~b)
    335:58.71 E       |   ^~~~~~~~
    335:58.72 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1555:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.73 E  1555 | { HB_PARTIALIZE(2);
    335:58.74 E       |   ^~~~~~~~~~~~~~~~
    335:58.75 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.76 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.77 E       |        ^~~~~~~~
    335:58.78 E fatal error: too many errors emitted, stopping now [-ferror-limit=]
    
    

    the fix is in harfbuzz-14.3.0 I guess?

  4. behdad commented on Aug 7, 2026

    @behdad
    Member

    I hit this in firefox-153.0 when building with clang-23.1.0_rc2:

    335:57.96 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-meta.hh:140:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:57.99 E   140 |   operator () (hb::shared_ptr<T>& v) const HB_AUTO_RETURN (*v)
    335:57.99 E       |   ^~~~~~~~
    335:58.01 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-meta.hh:143:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.02 E   143 |   operator () (const hb::unique_ptr<T>& v) const HB_AUTO_RETURN (*v)
    335:58.02 E       |   ^~~~~~~~
    335:58.04 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-meta.hh:146:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.05 E   146 |   operator () (hb::unique_ptr<T>& v) const HB_AUTO_RETURN (*v)
    335:58.05 E       |   ^~~~~~~~
    335:58.10 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:386:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.11 E   386 |   operator () (T& v) const { return v; }
    335:58.12 E       |   ^~~~~~~~
    335:58.13 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:389:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.14 E   389 |   operator () (T&& v) const { return v; }
    335:58.15 E       |   ^~~~~~~~
    335:58.16 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:519:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.17 E   519 |   impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, (uint32_t) (v ^ (v >> 32)) * 2654435761u /* Knuth's multiplicative hash */)
    335:58.18 E       |   ^~~~
    335:58.19 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:526:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.21 E   526 |   impl (const T& v, hb_priority<0>) const HB_RETURN (uint32_t, std::hash<hb_decay<decltype (hb_deref (v))>>{} (hb_deref (v)))
    335:58.21 E       |   ^~~~
    335:58.23 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:744:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.24 E   744 |   impl (T1&& v1, T2 &&v2, hb_priority<2>) const HB_AUTO_RETURN
    335:58.24 E       |   ^~~~
    335:58.26 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:756:3: error: unused function template 'impl' [-Werror,-Wunused-template]
    335:58.27 E   756 |   impl (T1&& v1, T2 &&v2, hb_priority<0>) const HB_AUTO_RETURN
    335:58.27 E       |   ^~~~
    335:58.29 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1500:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.29 E  1500 | { HB_PARTIALIZE(2);
    335:58.30 E       |   ^~~~~~~~~~~~~~~~
    335:58.31 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.32 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.33 E       |        ^~~~~~~~
    335:58.34 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1506:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.35 E  1506 | { HB_PARTIALIZE(2);
    335:58.36 E       |   ^~~~~~~~~~~~~~~~
    335:58.37 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.38 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.39 E       |        ^~~~~~~~
    335:58.40 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1512:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.41 E  1512 | { HB_PARTIALIZE(2);
    335:58.41 E       |   ^~~~~~~~~~~~~~~~
    335:58.42 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.43 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.44 E       |        ^~~~~~~~
    335:58.45 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1518:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.46 E  1518 | { HB_PARTIALIZE(2);
    335:58.48 E       |   ^~~~~~~~~~~~~~~~
    335:58.49 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.49 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.50 E       |        ^~~~~~~~
    335:58.51 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1524:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.52 E  1524 | { HB_PARTIALIZE(2);
    335:58.52 E       |   ^~~~~~~~~~~~~~~~
    335:58.53 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.54 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.55 E       |        ^~~~~~~~
    335:58.56 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1530:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.57 E  1530 | { HB_PARTIALIZE(2);
    335:58.57 E       |   ^~~~~~~~~~~~~~~~
    335:58.58 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.59 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.60 E       |        ^~~~~~~~
    335:58.61 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1532:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.62 E  1532 |   operator () (const T &a, const T &b) const HB_AUTO_RETURN (~a | b)
    335:58.62 E       |   ^~~~~~~~
    335:58.64 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1536:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.64 E  1536 | { HB_PARTIALIZE(2);
    335:58.65 E       |   ^~~~~~~~~~~~~~~~
    335:58.66 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.67 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.68 E       |        ^~~~~~~~
    335:58.69 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1538:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.70 E  1538 |   operator () (const T &a, const T &b) const HB_AUTO_RETURN (a | ~b)
    335:58.71 E       |   ^~~~~~~~
    335:58.72 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:1555:3: error: unused function template 'operator()' [-Werror,-Wunused-template]
    335:58.73 E  1555 | { HB_PARTIALIZE(2);
    335:58.74 E       |   ^~~~~~~~~~~~~~~~
    335:58.75 E /var/tmp/portage/www-client/firefox-153.0/work/firefox-153.0/gfx/harfbuzz/src/hb-algs.hh:636:8: note: expanded from macro 'HB_PARTIALIZE'
    335:58.76 E   636 |   auto operator () (_T&& _v) const HB_AUTO_RETURN \
    335:58.77 E       |        ^~~~~~~~
    335:58.78 E fatal error: too many errors emitted, stopping now [-ferror-limit=]
    

    the fix is in harfbuzz-14.3.0 I guess?

    I believe so.

  5. stefson commented on Aug 7, 2026

    @stefson

    for clang-23 this needs both b011381 and 5e887d3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions