<div dir="ltr">The post-commit review thread for this warning concluded that this warning probably shouldn't be on by default, but looks like it didn't get disabled.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 25, 2017 at 2:33 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;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>
<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>