https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113830
--- Comment #13 from Bo Wang <wangbopku15 at gmail dot com> --- (In reply to Harald van Dijk from comment #12) > (In reply to Bo Wang from comment #11) > > I have read the working draft standard of C++20 > > (https://github.com/cplusplus/draft/tree/c%2B%2B20). > > > > Following the subsection "13.9.2 Explicit instantiation" in the section > > "13.9 Template instantiation and specialization", the statement `template > > void f<int>();` is an explicit instantiation, which requires instantiating > > everything in the function. > > Where are you getting "everything in the function" from? It seems to say > rather the opposite in [temp.explicit]p14: > > > An explicit instantiation does not constitute a use of a default argument, > > so default argument instantiation is not done. > > Now, the example shows that this was intended to apply to default arguments > of the function itself, but the actual wording does not limit it to that, so > I actually think this is a bug in clang, by the current wording this must be > accepted? Please refer to the example in Comment 9 which has no default arguments. For the standard, I found this one in "13.9 Template instantiation and specialization" p6 of C++20, which requires access checking. > The usual access checking rules do not apply to names in a declaration of an > explicit instantiation or explicit specialization, with the exception of > names > appearing in a function body, default argument, base-clause, member- > specification, enumerator-list, or static data member or variable template > initializer. [Note: In particular, the template arguments and names used in > the > function declarator zincluding parameter types, return types and exception > specifications) may be private types or objects that would normally not be > accessible. —end note] Also, I don't think Clang rejecting these codes is buggy.