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

            Bug ID: 68863
           Summary: Regular expressions: Backreferences don't work in
                    negative lookahead
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: allthecoolkidshaveone at gmail dot com
  Target Milestone: ---

The following snippet should print out 'false' (And does on perl, javascript,
Microsoft's C++ compiler and everything else I tested on) but instead prints
out 'true' with g++/libstdc++.

#include <iostream>
#include <regex>

int main(void) {
        std::cout.setf(std::ios_base::boolalpha);
        std::cout << std::regex_match("aa", std::regex("(.)(?!\\1).")) << '\n';
        return 0;
}


It appears that backreferences aren't used in lookaheads in the libstdc++ regex
implementation like they should be?

Reply via email to