For some reason there is still lack of expected CTAD for std::initializer_list
in clang:
std::initializer_list l{1,2,3}; // error in clang
Adding a user-defined guide like the following can fix the issue:
namespace std {
template<class T>
initializer_list(const initializer_list<T>&) -> initializer_list<T>;
}
But is it allowed to add a user-defined guide for CTAD for std::
types?
Adding a deduction guide to a standard library type is UB [namespace std]§4.4:
The behavior of a C++ program is undefined if it declares : [...]
- a deduction guide for any standard library class template.