https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124000
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We also throw an exception here for strict modes, while libc++ does not:
#include <regex>
int main()
{
std::regex("(.)\\1", std::regex::ECMAScript); // OK
std::regex("\\(.\\)\\1", std::regex::basic); // OK
std::regex("(.)\\1", std::regex::extended); // fails
}
I think we are correct according to POSIX. EREs do not support back references,
at all.
For -std=gnu++NN modes we ignore the backslashes and treat \1 as an ordinary
character.
Some implementations of 'grep -E' do support backrefs, so we could consider
allowing backrefs for regex::egrep, but keep rejecting them for
regex::extended.