<div dir="ltr">Following compilation shows the issue:<br><br> $ clang++ --version<br> clang version 6.0.0 (trunk 316414)<br> Target: x86_64-unknown-linux-gnu<br> Thread model: posix<br> InstalledDir: /opt/compiler-explorer/clang-<wbr>trunk/bin<br><br> $ cat a.cpp<br> template <typename T><br> struct S<br> {<br> template <typename U><br> S(U&&) {}<br> };<br><br> template <typename T><br> S(T) -> S<T>;<br><br> int main()<br> {<br> S s(42);<br> }<br><br> $ clang++ -std=c++17 -Wundefined-func-template a.cpp<br>
a.cpp:13:7: warning: instantiation of function '<deduction guide
for S><int>' required here, but no definition is available
[-Wundefined-func-template]<br> S s(42);<br> ^<br> a.cpp:9:1: note: forward declaration of template entity is here<br> S(T) -> S<T>;<br> ^<br>
a.cpp:13:7: note: add an explicit instantiation declaration to
suppress this warning if '<deduction guide for S><int>' is
explicitly instantiated in another translation unit<br> S s(42);<br> ^<br><br>I found out that this warning occurs at lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp:3809:<br><br> else if (TSK == TSK_ImplicitInstantiation) { //< here<br> if (AtEndOfTU && !getDiagnostics().<wbr>hasErrorOccurred()) {<br> Diag(PointOfInstantiation, diag::warn_func_template_<wbr>missing)<br> << Function;<br> Diag(PatternDecl->getLocation(<wbr>), diag::note_forward_template_<wbr>decl);<br> if (getLangOpts().CPlusPlus11)<br> Diag(PointOfInstantiation, diag::note_inst_declaration_<wbr>hint)<br> << Function;<br> }<br> }<br><br>Shouldn't that check whether it's a deduction guide, or should it even require a definition?</div>