#include <iostream>
#include <array>
using namespace std;
template<const int *ptr>
constexpr const int *Test()
{
return ptr + 1;
}
constexpr array<int, 3> ar{1, 2, 3};
int main()
{
// clang version 15.0.7 - Compile Error!
// gcc 12.2.0 - ok!!
constexpr auto x = Test<ar.data()>(); // 1
cout << *x << endl;
return 0;
}
Компилятор clang выдает маловразумительные сообщения:
main.cpp|18|error: no matching function for call to 'Test'|
main.cpp|7|note: candidate template ignored: invalid explicitly-specified argument for template parameter 'ptr'|
Как можно минимально поправить код, чтобы и clang и gcc компилировали?