[libc++][test] re.regex.construct/bad_backref.pass.cpp
assumes non-standard extension to extended regular expressions
#122638
Labels
libc++ supports backreferences as a non-standard extension to POSIX extended regular expressions (see Section 9.5.1 of the POSIX standard, which specifies that the token "BACKREF" is applicable to basic regular expressions only).
The
bad_backref.cpp
test assumes this non-standard extension as well: It expects in various places that theerror_backref
error code is thrown on illegal backreferences for extended and egrep regular expressions. Example:llvm-project/libcxx/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
Line 37 in 7532958
These extended and egrep mode tests fail for MSVC STL, because it does not support backreferences in extended regular expressions in accordance with the POSIX standard. Consequently, it produces the error code
error_escape
instead oferror_backref
, because there is no concept of backreferences in extended regular expressions from MSVC STL's point of view.Side note: The test also tries to check in various places that some regular expressions with backreferences are parsed successfully:
llvm-project/libcxx/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
Line 38 in 7532958
But what is actually checked here is that no
regex_error
with codeerror_backref
is thrown. Because of this, MSVC STL actually passes a few lines that try to check that backreferences are parsed successfully in extended and egrep mode even though it doesn't support backreferences in these modes at all:llvm-project/libcxx/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
Line 73 in 7532958
llvm-project/libcxx/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
Line 77 in 7532958
llvm-project/libcxx/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
Line 82 in 7532958
llvm-project/libcxx/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
Line 88 in 7532958
(If these four lines are changed to actually test a successful parse, they should be moved to a libc++-specific test file since they test a non-standard extension.)
The text was updated successfully, but these errors were encountered: