<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/74016>74016</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `-Wundefined-func-template` warns that no definition is available for a pure virtual function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            false-positive
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ahatanak
      </td>
    </tr>
</table>

<pre>
    The warning seems incorrect as `B::bar` is pure virtual and its definition isn't needed.

$ cat test.cpp
```
template <typename T> class B {
public:
  constexpr void foo(const T &) { bar(1); }
  virtual constexpr void bar(unsigned int) = 0;
};

template <typename T> class D : public B<T> {
public:
  constexpr void bar(unsigned int) override {}
};

void test() {
  auto t = D<int>();
 t.foo(0);
}
```

$ clang++ -std=c++20 test.cpp -Wundefined-func-template -c
test.cpp:4:35: warning: instantiation of function 'B<int>::bar' required here, but no definition is available [-Wundefined-func-template]
  constexpr void foo(const T &) { bar(1); }
                                  ^
test.cpp:5:26: note: forward declaration of template entity is here
  virtual constexpr void bar(unsigned int) = 0;
                         ^
test.cpp:4:35: note: add an explicit instantiation declaration to suppress this warning if 'B<int>::bar' is explicitly instantiated in another translation unit
 constexpr void foo(const T &) { bar(1); }
 ^
1 warning generated.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVduS2jgTfpr2TReULGEDF77gMDzBVP3XstUG_Sskr9QmmbffkgHPTLLJZisLFJaE-PQdum2dkj17ogaqPVTHQo98CbHRF83a6z-KNpi35vVC-EVHb_0ZE9E1ofVdiJE6Rp0QarEHtQO1a3WEWqBNOIyR8GYjj9qh9gYtJzTUW2_ZBo82eZBrRk9kyCxBHEHsHt9yhZ1mZEq87IbhsVqLx2eaMl0Hp5kQ1IHfBvL6SvgK6gU7p1PCPcJ6f986jK2zXSY4TRG74BPT1yHiLViDfQggN9MiviLI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