Can't call in-place unexpected constructor with more than one param
BMBurstein opened this issue · comments
Baruch commented
Am I using this wrong, or is it a bug?
#include "tl/expected.hpp"
struct S {
S(int) {}
S(int,int) {}
};
int main() {
tl::expected<int, S> ex1(tl::unexpect, 2); // works
tl::expected<int, S> ex2(tl::unexpect, 2, 2); // fails
}
Baruch commented
It seems there is an appropriate constructor for expected
(https://tl.tartanllama.xyz/en/latest/api/expected.html#_CPPv4IDpEN8expected8expectedEN2tl10unexpect_tEDpRR4Args), which forwards to the constructor for unexpected
, which is missing the constructor taking Args...