[PATCH] D79344: [cuda] Start diagnosing variables with bad target.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 7 17:24:03 PDT 2020


tra added a comment.

Here's a slightly smaller variant which may be a good clue for tracking down the root cause. This one fails with:

  var.cc:6:14: error: no matching function for call to 'copysign'
    double g = copysign(0, g);
               ^~~~~~~~
  var.cc:5:56: note: candidate template ignored: substitution failure [with e = int, f = double]: reference to __host__ variable 'b' in __device__ function
  __attribute__((device)) typename c<a<f>::b, double>::d copysign(e, f) {
                                           ~             ^
  1 error generated when compiling for sm_60.

I suspect that it's handling of non-type template parameter that may be breaking things in both cases.

  template <typename> struct a { static const bool b = true; };
  template <bool, class> struct c;
  template <class h> struct c<true, h> { typedef h d; };
  template <typename e, typename f>
  __attribute__((device)) typename c<a<f>::b, double>::d copysign(e, f) {
    double g = copysign(0, g);
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79344





More information about the cfe-commits mailing list