Почему этот код C ++ с расширенными сгибами ограничения отклоняется Clang Trunk?C++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 Почему этот код C ++ с расширенными сгибами ограничения отклоняется Clang Trunk?

Сообщение Anonymous »

Код: Выделить всё

#include 

template 
concept floating_point = std::is_floating_point_v;

template 
concept integral = std::is_integral_v;

template 
concept arithmetic = floating_point || integral;

// ------------------------------------

template 
constexpr int f() {
return 1;
}

template 
constexpr int f() {
return 2;
}

// ------------------------------------

template 
requires(arithmetic && ...)
constexpr int g() {
return 1;
}

template 
requires(floating_point && ...)
constexpr int g() {
return 2;
}

// ------------------------------------

template 
concept all_arithmetic = (arithmetic && ...);

template 
concept all_floating_point = (floating_point && ...);

template 
requires all_arithmetic
constexpr int h() {
return 1;
}

template 
requires all_floating_point
constexpr int h() {
return 2;
}

// ------------------------------------

static_assert(f() == 1);     // ok
static_assert(f() == 2);  // ok

static_assert(g() == 1);     // ok
static_assert(g() == 2);  // ok

static_assert(h() == 1);     // ok
static_assert(h() == 2);  // error (why is this not resolved even after p2963?)

int main() {}
< /code>
ошибка: < /p>
:67:15: error: call to 'h' is ambiguous
67 | static_assert(h() == 2);  // error (why is this not resolved even after p2963?)
|               ^~~~~~~~~
https://godbolt.org/z/jnye1jqqm
образно пакет параметров эквивалентны, а арифметика submers floating_point .
Я не знаю, почему именование сгиба>

Подробнее здесь: https://stackoverflow.com/questions/795 ... lang-trunk
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C++»