| Issue |
87368
|
| Summary |
Meaningless constraints (enable_if-s) on basic_string constructors
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
AndreyG
|
Since the commit 76b26852b6be6e54c86741c7c80ca6b5d74eab2e some constructors of `basic_string` are "constrained" by `enable_if` which depends only on template parameters of the class `basic_string` itself. It's meaningless, and I'd say even harmful because it just slows down compilation but doesn't bring any value. For instance,
- https://github.com/llvm/llvm-project/blob/6b7b18a1a7fd37cea5f5d51569309e7ec954cefb/libcxx/include/string#L970
- https://github.com/llvm/llvm-project/blob/6b7b18a1a7fd37cea5f5d51569309e7ec954cefb/libcxx/include/string#L977
- https://github.com/llvm/llvm-project/blob/6b7b18a1a7fd37cea5f5d51569309e7ec954cefb/libcxx/include/string#L1027
(note that `_Allocator` is the template parameter of the class `basic_string`, but not the constructor).
If `_Allocator` doesn't satisfy the requirement `__is_allocator`, then compilation fails during instantiation of `basic_string` (https://gcc.godbolt.org/z/7jbdrheov), it's not SFINAE error, because substitution of the type of NTTP parameter is not invoked lazily (https://gcc.godbolt.org/z/oaWbhbve9).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs