[PATCH] D56411: [CUDA][HIP][Sema] Fix template kernel with function as template parameter

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 21 14:32:46 PST 2019


rjmccall added a comment.

In D56411#1365727 <https://reviews.llvm.org/D56411#1365727>, @yaxunl wrote:

> In D56411#1360010 <https://reviews.llvm.org/D56411#1360010>, @rjmccall wrote:
>
> > I think the diagnostic should come during instantiation when you find an evaluated use of a host function within a device function.
>
>
> It seems the body of function template is checked only during parsing of the definition of the template itself. When a function
>  template is instantiated, the body of the instantiated function is not checked again.


No, that's not correct.  However, it's checked somewhat differently, and it's possible that the existing diagnostic is not set up to fire along all common paths.  Try moving the diagnostic to `MarkFunctionReferenced`, and note that `OdrUse` will be `false` in all the unevaluated contexts.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56411/new/

https://reviews.llvm.org/D56411





More information about the cfe-commits mailing list