Код: Выделить всё
template
struct type_tup {
};
template
struct test;
template
struct test {
template
static consteval void make() {
}
};
int main() {
test::make();
}
Код: Выделить всё
gccСообщение об ошибке :
: In function 'int main()':
:16:56: error: no matching function for call to 'test::make()'
16 | test::make();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
:11:27: note: candidate: 'template static consteval void test::make() [with beginning ...beg_vals = {beg_vals ...}; end end_val = end_val; end = char; beginning = {int, float}]'
11 | static consteval void make() {
| ^~~~
:11:27: note: template argument deduction/substitution failed:
:16:56: error: conversion from 'float' to 'char' in a converted constant expression
16 | test::make();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
:16:56: error: could not convert '6.0e+0f' from 'float' to 'char'
16 | test::make();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| float
:16:56: error: wrong number of template arguments (3, should be 2)
:11:27: note: provided for 'template static consteval void test::make() [with beginning ...beg_vals = {beg_vals ...}; end end_val = end_val; end = char; beginning = {int, float}]'
11 | static consteval void make() {
| ^~~~
Compiler returned:
Код: Выделить всё
msvcСообщение об ошибке :
example.cpp
(11): error C3547: template parameter 'end_val' cannot be used because it follows a template parameter pack and cannot be deduced from the function parameters of 'test::make'
(10): note: see declaration of 'end_val'
(11): note: the template instantiation context (the oldest one first) is
(9): note: while compiling class template partial specialization 'test'
Compiler returned: 2
godbolt, case 1
I continued my experiment swapping beginning... and end parameter in make():
Код: Выделить всё
template
struct type_tup {
};
template
struct test;
template
struct test {
template
static consteval void make() {
}
};
int main() {
test::make();
}
Код: Выделить всё
gccСообщение об ошибке godbolt, случай 2
I я почти уверен, что gcc как минимум неверно выдает сообщение об ошибке.
Мои вопросы:
- Первый источник действителен?
- Второй источник действителен? действительно?
- Есть ли отчет об ошибке для gcc?
Подробнее здесь: https://stackoverflow.com/questions/793 ... on-failure
Мобильная версия