[Please CC me on replies, I'm not subscribed to the list]

Dear Bison developers,

Between Bison 3.0 and 3.2, a regression has appeared in C++ parsers
with variant semantic values. More precisely, it is no longer possible
to use a C++ type which has a comma in it (e.g. pair<int,int>), since
that interferes with a macro that has been introduced.

I attach a minimal example. It compiles fine with Bison 3.0, but with
Bison 3.2 I get:

In file included from test.yy:7:
test.tab.hh:507:77: error: macro "YY_RVREF" passed 2 arguments, but takes just 1
       basic_symbol (typename Base::kind_type t, YY_RVREF (std::pair<int,int>) 
v);
                                                                             ^
test.tab.cc:178:101: error: macro "YY_RVREF" passed 2 arguments, but takes just 
1
   parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, 
YY_RVREF (std::pair<int,int>) v)
                                                                                
                     ^
In file included from test.yy:7:
test.tab.hh:507:49: error: 'YY_RVREF' has not been declared
       basic_symbol (typename Base::kind_type t, YY_RVREF (std::pair<int,int>) 
v);
                                                 ^~~~~~~~
test.tab.cc:178:73: error: 'YY_RVREF' has not been declared
   parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, 
YY_RVREF (std::pair<int,int>) v)
                                                                         
^~~~~~~~

Maybe you don't consider this as a bug (since it can be easily worked
around with a typedef/using), but at the very least it should be
documented.

Best,

-- 
⢀⣴⠾⠻⢶⣦⠀  Sébastien Villemot
⣾⠁⢠⠒⠀⣿⡁  Debian Developer
⢿⡄⠘⠷⠚⠋⠀  http://sebastien.villemot.name
⠈⠳⣄⠀⠀⠀⠀  http://www.debian.org
%language "c++"
%require "3.0"
%defines
%define api.value.type variant

%{
#include "test.tab.hh"

int yylex (yy::parser::semantic_type *yylval);
%}

%type <std::pair<int,int>> expr
%%

%start expr;

expr : %empty { $$ = std::make_pair(0, 1); };

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to