In short, what is inherently wrong with the following code?
#include <regex>
int main() {
std::regex_match(u" ", std::basic_regex<char16_t>{u" "});
}
It errors with
$ g++ -std=c++17 main.cpp -o main
$ ./main
terminate called after throwing an instance of 'std::bad_cast'
what(): std::bad_cast
Aborted (core dumped)
More info:
$ g++ --version
g++ (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The C++ standard library does not support regex with char16_t or char32_t Unicode. There is a proposal to address this, but it is not in C++20: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0169r0.html