Issue 134347
Summary `<flat_set>`: `flat_set::emplace()` is underconstrained
Labels new issue
Assignees
Reporter hewillk
    [[flat.set.modifiers]](https://eel.is/c++draft/flat.set.modifiers#1):

> ```cpp
> template<class K> constexpr pair<iterator, bool> insert(K&& x);
> template<class K> constexpr iterator insert(const_iterator hint, K&& x);
> ```
> Constraints: The _qualified-id_ `Compare​::​is_transparent` is valid and denotes a type. `is_constructible_v<value_type, K>` is `true`.

This means that the following code is well-formed since we will not enter the `emplace` branch:

```cpp
#include <flat_set>
#include <ranges>
#include <vector>

int main() {
  std::vector<int> v;
  auto m = std::ranges::to<std::flat_set<int>>(v, v);
}
```
https://godbolt.org/z/6hj55Mqdr

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to