https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77469
Bug ID: 77469 Summary: std::regex x("[b\\-a]") throws with message "Invalid range in bracket expression." Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: alban...@baker-research.com Target Milestone: --- Hello, The std::regex constructor throws when passed "[b\\-a]". The message is "Invalid range in bracket expression.". I understand that this is a valid regular expression that specifies a character class consisting of a literal "b", a literal "-", and a literal "a". g++ version: 6.2.0. System: Ubuntu 12.04.2 LTS. Output of 'uname -a': Linux zeus 3.2.0-68-generic #102-Ubuntu SMP Tue Aug 12 22:02:15 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux gcc configuration options: ./configure --disable-multilib Build command line: g++ testRegex.cc -o testRegex -std=c++11 -Wall -Wextra -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -fsanitize=undefined There are no compiler messages. This behaviour does not occur with gcc Ubuntu 4.9.2-0ubuntu1~14.04. This behaviour also occurs with MinGW-W64 5.3.0 and 6.1.0. Thank you, Alban