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

Aperta
#336 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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>
Lingua principale
C++
Stelle
185
Fork
28
Merge medio
20h 44m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di boostorg/parser

Tutte le issue di boostorg/parser

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.