This code does not compile with gcc14 with -std=c++20
.
#include <tuple>
#include <type_traits>
struct Foo
{
template<typename T>
Foo(T) {}
};
struct Bar
{
Bar(std::tuple<Foo>) {}
};
int main()
{
return std::is_constructible_v<Foo, Bar>;
}
Errors include
tuple:979:42: error: satisfaction of atomic constraint '__constructible<_UTypes ...>() [with _Elements = {_Elements ...}; _UTypes = {_UTypes ...}]' depends on itself
tuple:989:42: error: 'static consteval bool std::tuple< <template-parameter-1-1> >::__constructible() [with _UTypes = {Bar}; _Elements = {Foo}]' called in a constant expression before its definition is complete
tuple:989:42: error: satisfaction value of atomic constraint '__constructible<_UTypes ...>() [with _Elements = {Foo}; _UTypes = {Bar}]' changed from '<expression error>' to 'true'
Full output could be seen here:
This code compiles with -std=c++17
or with gcc13 or older. Putting explicit
on Bar
constructor also resolves the problem.
Does anyone know what is happening here or how this can be worked around, besides putting explicit
on Bar
?
Some context: the problem was detected while trying to copy Bar
.
Bar b1{Foo{0}};
Bar b2{b1};
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744800899a4594483.html
评论列表(0条)