https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71500

            Bug ID: 71500
           Summary: regex::icase only works on first character in a range
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glexey at gmail dot com
  Target Milestone: ---

The code below should match regex in all 4 cases: 

#include <iostream>
#include <regex>
#include <string>

using namespace std;

void check(const string& s, regex re) {
    cout << s << " : " << (regex_match(s, re) ? "Match" : "Nope") << endl;
}

int main() {
    regex re1("[A-F]+", regex::icase);
    check("aaa", re1);
    check("AAA", re1);
    check("fff", re1);
    check("FFF", re1);
}

Instead:

$ g++ -std=c++11 test.cc -o test && ./test
aaa : Match
AAA : Match
fff : Nope
FFF : Match


$ g++ -v
Reading specs from /disk1/pkgs/gcc/5.2/lib64/gcc/x86_64-suse-linux/5.2.0/specs
COLLECT_GCC=/usr/pkgs/gcc/5.2/.bin/g++
COLLECT_LTO_WRAPPER=/disk1/pkgs/gcc/5.2/libexec/gcc/x86_64-suse-linux/5.2.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ./configure --prefix=/usr/pkgs/gcc/5.2
--libdir=/usr/pkgs/gcc/5.2/lib64 --libexecdir=/usr/pkgs/gcc/5.2/libexec
--bindir=/usr/pkgs/gcc/5.2/bin --with-ppl=/usr/pkgs/gcc/5.2
--enable-cloog-backend=ppl --with-cloog=/usr/pkgs/gcc/5.2
--with-libelf=/usr/pkgs/gcc/5.2 --with-mpfr=/usr/pkgs/gcc/5.2
--with-gmp=/usr/pkgs/gcc/5.2 --with-mpc=/usr/pkgs/gcc/5.2
--disable-gnu-unique-object --enable-lto
--enable-languages=c,c++,objc,fortran,java --build=x86_64-suse-linux
--host=x86_64-suse-linux --target=x86_64-suse-linux
Thread model: posix
gcc version 5.2.0 (GCC)

Reply via email to