[PATCH] D80450: [CUDA][HIP] Fix implicit HD function resolution

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 12:07:51 PDT 2020


tra added a comment.

In D80450#2087938 <https://reviews.llvm.org/D80450#2087938>, @tra wrote:

> Reproducer for the regression. https://gist.github.com/Artem-B/183e9cfc28c6b04c1c862c853b5d9575
>  It's not particularly small, but that's as far as I could get it reduced.
>
> With the patch, an attempt to instantiate `ag` on line 36 (in the reproducer sources I linked to above) results in ambiguity between two templates on lines 33 and 24 that are in different namespaces.
>  Previously it picked the template on line 28.


Managed to simplify the reproducer down to this which now reports that a host candidate has been ignored. This may explain why we ended up with the ambiguity when other overloads were present.

  template <typename> struct a {};
  namespace b {
  struct c : a<int> {};
  template <typename d> void ag(d);
  } // namespace b
  template <typename ae>
  __attribute__((host)) __attribute__((device)) int ag(a<ae>) {
    ae e;
    ag(e);
  }
  void f() { ag<b::c>; }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80450





More information about the cfe-commits mailing list