Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Creation of self referencing regexp throws exception "bad regex reference"

オープン
#8 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp
領域
tooling

調査の方向性

boost/xpressive/xpressive.hpp を使用して、提供された再現手順から始め、boost::xpressive::detail::regex_matcher::static_compile_impl2 を通じて代入を追跡します。これには、レポートで言及されている impl->tracking_clear() の呼び出しも含まれます。例を使用して、結果として得られる複合式を "foololo" と "barlolo" の両方に対して検証します。

索引モデルが issue の本文から書いたものです。

説明

Hi.
I'm trying to create composite regular expression by appending pieces one at a time.

Example:

#include <boost/xpressive/xpressive.hpp>

#include <iostream>
#include <string>

int main()
{
  using namespace boost::xpressive;
  using namespace std::string_literals;
  auto regex = sregex{ bos >> as_xpr("foo") >> *_ };

  regex = regex | sregex{ bos >> as_xpr("bar") >> *_ };

  std::cout << regex_match("foololo"s, regex) << std::endl;
  std::cout << regex_match("barlolo"s, regex) << std::endl;

  return 0;
}

I get exception from regex = regex | sregex{ bos >> as_xpr("bar") >> *_ };. It seems that inside of assignment it enters boost::xpressive::detail::regex_matcher::static_compile_impl2(...), does impl->tracking_clear(); and partially clears contents of the temporary object on the right hand side of assignment operator.

It seems to me that my case is pretty similar to the case described in the Embedding a Regex by Value example. I am able to reproduce this behavior for boost 1.65.1 and 1.66.0 on both MSVC 2015 sp1 with /std:c++=latest and gcc 7.2.0.

How should I create such composite regular expression assuming I don't have all the pieces at once?

主要言語
C++
スター
19
フォーク
40
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

boostorg/xpressive のほかの issue

boostorg/xpressive の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。