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

Aberta
#336 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
cpp
Domínio
backend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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>
Linguagem predominante
C++
Estrelas
185
Forks
28
Merge médio
20h 44min
PRs com merge (30d)
1

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de boostorg/parser

Todas as issues de boostorg/parser

Issues semelhantes

Mais issues de C++

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.