https://bugs.llvm.org/show_bug.cgi?id=40366
Bug ID: 40366
Summary: Failure to deduce template arguments for
std::initializer_list aliases
Product: clang
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++'17
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Using an alias for std::initializer_list results in a failure to deduce
template arguments as in the following example (it compiles fine with GCC 8.2):
#include <initializer_list>
template <typename T>
using IL = std::initializer_list<T>;
template <typename T>
struct Foo {
Foo(IL<T> list) {}
};
int main() {
Foo foo{42}; // Error: no viable constructor or deduction guide
// for deduction of template arguments of 'Foo'
return 0;
}
However, the next deduction guide fixes the error:
template <typename T>
Foo(std::initializer_list<T>) -> Foo<T>;
The deduction guide doesn't work if we use IL<T> instead of
std::initializer<T>.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs