================ @@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, if (NewFD->hasAttr<SYCLKernelEntryPointAttr>()) SYCL().CheckSYCLEntryPointFunctionDecl(NewFD); + if (NewFD->hasAttr<SYCLExternalAttr>()) + SYCL().CheckSYCLExternalFunctionDecl(NewFD); ---------------- tahonermann wrote:
Yes, that is exactly what is happening. For an explicit instantiation, the template specialization kind isn't set (via `FunctionDecl::setTemplateSpecializationKind()` until near the end of `Sema::ActOnExplicitInstantiation()`. That seems somewhat unfortunate but there appears to be some interactions with the `dllimport` attribute. Certainly not something we should address in this PR. For an explicit specialization, the template specialization kind is set in time, but we have the long standing issue that a declaration is implicitly instantiated and becomes the previous declaration of the explicit specialization which inherits attributes. We're clearly not going to address that in this PR. Thinking about this some more, I don't think we should diagnose explicit template instantiations (either declarations or definitions). Note that explicit template instantiation doesn't allow for attributes to be specified; these are not syntactically valid: ``` extern template [[clang::sycl_external]] void ft<some-type>(); template [[clang::sycl_external]] void ft<some-type>(); ``` I think we have a couple more tests to add (I'll add separate comments for those), but I think this is going to work out how we want it to (and if we don't diagnose the explicit template specializations, it isn't a big deal anyway). https://github.com/llvm/llvm-project/pull/140282 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits