[PATCH] D134445: [PR57881][OpenCL] Fix incorrect diagnostics with templated types in kernel arguments
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 10 14:01:46 PST 2022
Anastasia added a comment.
In D134445#3920188 <https://reviews.llvm.org/D134445#3920188>, @rjmccall wrote:
> You really can't ask whether a class template pattern is standard layout; it's not meaningful.
Well the templates have to be instantiated with concrete types as kernels can't be called from the host code. But if the concrete type is a reference or pointer there is no full instantiation apparently as AST dumps in the review description show.
> How are pointers and references passed to kernels? Does the pointee get copied or something? If so, you may have a requirement that pointee types be complete, in which case the only problem is probably that you're doing this check too soon, or doing them on declarations rather than on definition/use.
Ok, the kernel function actually already contains the instantiated templates since they can't be templated themselves. My understanding is that references and pointers to templated types are not required to be fully instantiated as they are not ODR-used? At least this is what I deduce from my AST dump examples. I.e. it work fine if the templates are not references/pointers and it fails to create a complete instantiation otherwise.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134445/new/
https://reviews.llvm.org/D134445
More information about the cfe-commits
mailing list