Open
Description
The following well-formed C++20 code is rejected by clang (all version tested from 13 through trunk):
template <class T>
struct single : T {};
template <class A, class B>
struct pair {
A a;
B b;
};
struct immovable {
immovable() = default;
immovable(immovable&&) = delete;
};
struct S{};
int main() {
// error: call to deleted constructor of 'immovable'
[[maybe_unused]]
auto a = single<single<immovable>>{single<immovable>{immovable{}}};
// error: no viable conversion from 'pair<int, immovable>' to 'int'
[[maybe_unused]]
auto b = single<pair<int, immovable>>{pair<int, immovable>{42, immovable{}}};
// error: initializer for aggregate with no elements requires explicit braces
[[maybe_unused]]
auto c = single<pair<S, immovable>>{pair<S, immovable>{S{}, immovable{}}};
}
Other compilers get this right. https://godbolt.org/z/rorxx1jK9