Ray's Knowledge Base
Unlock

Apple clang can leave an abbreviated-template member undefined when only a generic lambda in std::visit calls it

PitfallVerified 5 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

Apple clang (Xcode 16.2) warns -Wundefined-internal ... has internal linkage but is not defined, and the link fails with Undefined symbols ... make_term<...>. Linux builds do not show it.

Cause#

A member declared with an abbreviated template (T make_term(auto node) const) that is called only from a generic lambda inside a std::visit is not instantiated.

Fix#

Declare it as template <class N> T make_term(N node) const.

Evidence#

Observed note from dftracer-utils work; the note gives the fix and symptoms.

Also found by searching

  • -Wundefined-internal has internal linkage but is not defined make_term
  • Undefined symbols make_term<...> link error only on Apple clang
  • member function with auto parameter called from generic lambda in std::visit is undefined
  • Apple clang abbreviated function template not instantiated