<regex>: After _Uelem changes, Build2 asserts in the Real World Code test suite (original) (raw)

After merging #5592, our test team reported VSO-2548012 "[RWC][prod/fe][Regression] Build2 test failed with Assertion failed: type () == line_type::special, file C:\gitP\Build2\build2-toolchain-0.17.0\build2\libbuild2/script/regex.hxx, line 208". The affected code is:

https://github.com/build2/build2/blob/05d68f47aa044da9161d9bfabdd153602169d902/libbuild2/script/regex.hxx#L200-L210

    // Provide basic_regex (such as from msvcrt) with the ability to
    // explicitly cast line_chars to implementation-specific numeric
    // types (enums, msvcrt's _Uelem, etc).
    //
    template <typename T>
    explicit
    operator T () const
    {
      assert (type () == line_type::special);
      return static_cast<T> (special ());
    }

I haven't yet attempted to repro this myself. I don't know if it's a bug in Build2 (i.e. a non-Standard assumption that we've broken), or a bug in #5592. I also don't know if this is further affected by the currently open #5671.

FYI @muellerj2.