[regex] unknown escape sequence in libs/regex/test/regress/test_perl_ex.cpp

regex library tests regex_regress[_threaded] fail to compile on gcc-4.2.1_hpux_ia64 because for a character string "(?<=*|\B)" gcc 4.2.1 emits a hard error "unknown escape sequence". gcc 3.4 series issues a warning, as well as EDG-based compilers. See reproducer below. The character string in question should, probably, be: "(?<=*|\\B)". Ok to change? Thanks, Boris x.cpp ----- char s[] = "\B"; bash-2.03$ g++ --version | head -1 ; g++ -c x.cpp g++ (GCC) 4.2.1 x.cpp:1: error: unknown escape sequence '\B' bash-2.03$ bash-3.00$ g++ --version | head -1 ; g++ -c x.cpp g++ (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3) x.cpp:1:12: warning: unknown escape sequence '\B' bash-3.00$ bash-2.04$ eccp --version -c x.cpp Edison Design Group C/C++ Front End, version 3.5 (Dec 20 2004 13:57:48) Copyright 1988-2004 Edison Design Group, Inc. "x.cpp", line 1: warning: unrecognized character escape sequence char s[] = "\B"; bash-2.04$

Boris Gubenko wrote:
regex library tests regex_regress[_threaded] fail to compile on gcc-4.2.1_hpux_ia64 because for a character string
"(?<=*|\B)"
gcc 4.2.1 emits a hard error "unknown escape sequence". gcc 3.4 series issues a warning, as well as EDG-based compilers. See reproducer below.
The character string in question should, probably, be: "(?<=*|\\B)".
Ok to change?
Yes please! Thanks, John.

John Maddock wrote:
Boris Gubenko wrote:
regex library tests regex_regress[_threaded] fail to compile on gcc-4.2.1_hpux_ia64 because for a character string
"(?<=*|\B)"
gcc 4.2.1 emits a hard error "unknown escape sequence". gcc 3.4 series issues a warning, as well as EDG-based compilers. See reproducer below.
The character string in question should, probably, be: "(?<=*|\\B)".
Ok to change?
Yes please!
Never mind, I see the problem, fixed in SVN, John.
participants (2)
-
Boris Gubenko
-
John Maddock