Hello,

After working on a patch about symbol aliases, I got a very unexpected bug:
when running make check, the generated examples/calc++/calc++-parser.hh has duplicate definitions for the basic_symbol. Around line 317, I get


  basic_symbol (typename Base::kind_type t, const location_type& l);

basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);

basic_symbol (typename Base::kind_type t, const int v, const location_type& l);

  basic_symbol (typename Base::kind_type t, const location_type& l);

basic_symbol (typename Base::kind_type t, const int v, const location_type& l);

  basic_symbol (typename Base::kind_type t, const location_type& l);


And around line 790, the corresponding implementations :


  // Implementation of basic_symbol constructor for each type.

  template <typename Base>
calcxx_parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
    : Base (t)
    , value ()
    , location (l)
  {}

  template <typename Base>
calcxx_parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
    : Base (t)
    , value (v)
    , location (l)
  {}

  template <typename Base>
calcxx_parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int v, const location_type& l)
    : Base (t)
    , value (v)
    , location (l)
  {}

  template <typename Base>
calcxx_parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
    : Base (t)
    , value ()
    , location (l)
  {}

  template <typename Base>
calcxx_parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int v, const location_type& l)
    : Base (t)
    , value (v)
    , location (l)
  {}

  template <typename Base>
calcxx_parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
    : Base (t)
    , value ()
    , location (l)
  {}


The nature of my patch is basically this: instead of having duplicate information in symbols and their aliases, and to be forced to resolve the differences later, the symbols now contain only their intrinsic information (name, location), and share with the alias a pointer to a structure containing the rest (precedence, etc...).

If you have a clue as to what is causing this bug, please tell me. Otherwise, if you could at least point me to the place in the code where the file is generated, I'd be grateful.

Thanks!

Valentin Tolmer

Reply via email to