Closed seanbaxter closed 1 month ago
#feature on safety template<typename T+> struct Vec { Vec() safe; void push_back(self^, T obj) safe; template<typename... Ts> void emplace_back(self^, Ts... obj) safe { // Direct initialization with the String(const char*) ctor. // This compiles, because T is unsafe-qualified. self.push_back(T(rel obj...)); } }; struct String { String(const char*); // Unsafe ctor. }; int main() safe { // Vec has a safe constructor. Vec<unsafe String> vec { }; // void Vec<unsafe String>::emplace_back(self^, const char*) safe; mut vec.emplace_back("A string"); }
Can't compile the vec.emplace_back call, but can call vec.place_back.
Fixed in build_sep_2_2024-1.tgz
Can't compile the vec.emplace_back call, but can call vec.place_back.