<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 25 October 2017 at 07:33, Mário Feroldi via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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-t<wbr>runk/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/SemaTemplateInstantia<wbr>teDecl.cpp:3809:<br><br> else if (TSK == TSK_ImplicitInstantiation) { //< here<br> if (AtEndOfTU && !getDiagnostics().hasErrorOccu<wbr>rred()) {<br> Diag(PointOfInstantiation, diag::warn_func_template_missi<wbr>ng)<br> << Function;<br> Diag(PatternDecl->getLocation(<wbr>), diag::note_forward_template_de<wbr>cl);<br> if (getLangOpts().CPlusPlus11)<br> Diag(PointOfInstantiation, diag::note_inst_declaration_hi<wbr>nt)<br> << Function;<br> }<br> }<br><br>Shouldn't that check whether it's a deduction guide, or should it even require a definition?</div></blockquote><div><br></div><div>Thanks for the report, we shouldn't even be trying to instantiate a definition for a deduction guide in the first place. Fixed in r316820.</div></div></div></div>