2

Could you confirm this is a regression in gcc?

Program

#include <type_traits>

template<class U, typename std::enable_if_t<std::is_const_v<U>>...>
void f() {}

int main()
{
    f<const int>();
    f<int>();
}

Compilation

  • gcc7.1 -std=c++17: template substitution failed on f<int>;
  • clang6.0 -std=c++17: no matching function for call to f on f<int>;
  • gcc8.2 -std=c++17: accepts the program.

Demo

https://godbolt.org/g/9vwsx1


Note: enable_if<...>::type... is valid here.

YSC
  • 38,212
  • 9
  • 96
  • 149

0 Answers0