This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/59756] New: off-by-one error in regex


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59756

            Bug ID: 59756
           Summary: off-by-one error in regex
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Nikolay.Bozhenov at gmail dot com

example:

$ cat case.cpp
#include <iostream>
#include <string>
#include <regex>

int main() {
    std::string re_s("abc(def)ghi");
    std::regex re(re_s);
    std::smatch mch;
    std::regex_match(std::string("abcdefghi"), mch, re);
    std::cout << mch[1].str() << std::endl;
}


compilation:

$ g++-4.8.2 case.cpp -std=c++11 -o case


actual result:

$ ./case
cdef


expected result:

$ ./case
def


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]