[PATCH] D25845: [CUDA] Ignore implicit target attributes during function template instantiation.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 15:29:24 PDT 2016


jlebar added a comment.

To close the loop, we talked about this IRL, and I agree this is the most sane option we can come up with.  The user-facing principle is that the signatures of function template specializations must match.  We consider CUDA attributes to be part of the function's signature.  Therefore the target attributes should match.

Now the question is, should the *implicit plus explicit* or *only explicit* target attributes match?  To me, implicit+explicit makes more sense on face.  But the problem is, we need to allow C++ code like

  constexpr template<typename T> void foo(T);
  template<> void foo(int);

We implicitly make constexpr functions HD.  The template specialization is not constexpr, so is not implicitly HD.  But we cannot disallow this code, because it's valid C++.  That effectively constrains our choice above to *only explicit* target attributes.


https://reviews.llvm.org/D25845





More information about the cfe-commits mailing list