简而言之,下面的代码有什么本质上的错误?
#include <regex>
int main() {
std::regex_match(u" ", std::basic_regex<char16_t>{u" "});
}
它与
$ 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)
更多信息:
$ 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.