https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118530

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Related variant, again by waffl3x, which fails with both GCC and Clang,
but works when changing the base-functions 'auto' to 'int'.

For GCC, the error is [SIC!]:
<source>: In substitution of 'template<class T> auto base(T) [with T = int]':
<source>:8:29: error: variant 'auto variant(T) [with T = int]' and base 'auto
base(T) [with T = int]' have incompatible types

--------------------

#include <type_traits>

template<typename T>
auto variant(T p) {
  return p;
}

#pragma omp declare variant(variant) match(device={kind("host")})
template<typename T>
auto base (T p) {
  return p;
}

int main()
{
  auto a = base(0);
  if constexpr (std::is_same_v<decltype(a), int>) {
    __builtin_printf("Yippie\n");
  }
}

Reply via email to