Using Boost.Hana causes hard compiler errors in some attribute propagation paths

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

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

評価

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

調査の方向性

Start in parser.hpp at the semantic action dispatch and attribute assembling paths around the two locations shown in the issue. Check how tuple operations follow BOOST_PARSER_USE_HANA_TUPLE elsewhere, then build the Mutable Symbol Tables tutorial example with Hana tuples. Done means the example builds and the existing std::tuple path still works.

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

説明

It seems semantic action dispatch and attribute "assembling" is hardcoded to use std::tuple ignoring BOOST_PARSER_USE_HANA_TUPLE flag.

Tutorial's example for Mutable Symbol Tables fails during build if uses Hana tuples (as current version of tutorial does).

Here is brief patch, which most likely don't follow library conventions but should make this issue visible:

diff --git a/parser.hpp b/parser.hpp
index 6a32dfb..18e8f51 100644
--- a/parser.hpp
+++ b/parser.hpp
@@ -3548,9 +3548,17 @@ namespace boost { namespace parser {
             };
             detail::skip(first, last, skip, flags);

+#if defined(BOOST_PARSER_USE_HANA_TUPLE)
+            boost::hana::unpack(parsers_, [&try_parser](auto&&... args) {
+#else
             std::apply([&try_parser](auto&&... args) {
+#endif
                 ((try_parser(args)), ...);
+#if defined(BOOST_PARSER_USE_HANA_TUPLE)
+            });
+#else
             }, parsers_);
+#endif

             if (!done)
                 success = false;
@@ -4608,9 +4616,18 @@ namespace boost { namespace parser {

             auto const parsers_and_indices =
                 detail::hl::zip(parsers_, indices, merged, backtracking{});
+#if defined(BOOST_PARSER_USE_HANA_TUPLE)
+            boost::hana::unpack(
+                parsers_and_indices, [&use_parser](auto&&... args) {
+#else
             std::apply([&use_parser](auto&&... args) {
+#endif
                 ((use_parser(args)), ...);
+#if defined(BOOST_PARSER_USE_HANA_TUPLE)
+            });
+#else
             }, parsers_and_indices);
+#endif
         }

         template<bool AllowBacktracking, typename Parser>
主要言語
C++
スター
185
フォーク
28
平均マージ
20時間 44分
マージ済み PR(30日)
1

環境構築

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

はじめの一歩

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

boostorg/parser のほかの issue

boostorg/parser の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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