<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65139>65139</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
A/F "friend function specialization without template args" on illegal C++
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jmorse
</td>
</tr>
</table>
<pre>
Hi,
Behold this bogus template specialisation:
template <a> class b {
template <> friend int c< b >() {}
};
Clang / GCC / MSVC all reject this with errors and diagnostics. With assertions enabled however, clang fires the following assertion failure rather than completing:
clang: /path/clang/lib/Sema/SemaDecl.cpp:10454: clang::NamedDecl *clang::Sema::ActOnFunctionDeclarator(clang::Scope *,
clang::Declarator &, clang::DeclContext *, clang::TypeSourceInfo *, clang::LookupResult &, clang::MultiTemplateParamsArg,
bool &): Assertion `HasExplicitTemplateArgs && "friend function specialization without template args"' failed.
when building with the very recent 22044f0bde015f4bf53fca24831d030ff96efc51. Godbolt link of the same: https://godbolt.org/z/7jabnhEY9 . Fiddling with Godbolt, it appears the assertion failure appeared in the 14.0.0 release, and isn't present in the 13.0.0 release.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVEGT2yYY_TX48k00CJBtHXSQtaukM03baTLt9IjQJ4kNAg2g3Wx-fQfZXnu2udUHY4v3nniPBzIEPVrEihQnUjzs5Bon56un2fmAu871r9UnTVhD6AOh9fn7hJMzPcRJB-jcuAaIOC9GRoSwoNLS6CCjdpbw-p4HADck4Y0k_BGUkSFAB-RwuqDuIQkxeI22B20jKMKbhOWPhB0JKzfW4eEmn_7w0_1LGyPtCIS18LFptvHzl78akMaAxydU8ezjRccJ0HvnA0jbQ6_laF2IWoUM_k6TMgT0yVUAtLIz2MPkXvAZPWFNsmFHGLTHAHFCGJwx7kXb8caDQWqzegQv44Qe4iQtKDcvBqO24_uwNkXC67TmRcaJsPb8iLVGd4S1X3CWl-EBl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