helpbison - Support: sr #106503, C++ template makes it very...


sr #106503: C++ template makes it very difficult to override functions

Submitted by:  Thomas Bleher <thomasbleher>
Submitted on:  Tue Sep 23 19:11:44 2008  
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating System: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Fri Mar 23 23:09:43 2012, comment #4:

Tim Landscheidt writes "This is probably a matter of taste." <>

Paul Eggert <eggert>
Project Administrator
Fri Nov 20 13:02:30 2009, comment #3:

Also, yytranslate_() (Convert a scanner token number to a bison symbol number) should be declared static.

Claude Brisson <claudebrisson>
Fri Nov 20 02:57:05 2009, comment #2:

I met the same limitation. Promote fields useful for debugging from private to protected looks like the way to go.

Claude Brisson <claudebrisson>
Wed Sep 24 09:22:17 2008, comment #1:

Additionally, it would be useful if yysyntax_error_ could access the semantic value of the erroneus token (yylval in parse()). This would be useful e.g. to print the exact string found for string tokens.

Thomas Bleher <thomasbleher>
Tue Sep 23 19:11:44 2008, original submission:

I'm currently trying to create a C++ parser, and I'm having some problems overriding certain functionality. Specifically, I'd like to derive a class from the bison-generated one and override yysyntax_error_ so I can generate special error messages. However, I cannot access most data structures as they are declared private (e.g. yytname_).

As far as I can see, this makes it impossible to properly replicate the work that yysyntax_error_ is doing (Please correct me if I'm wrong).

Suggested solution: change the "private:" declaration in to "protected:" so derived classes can access the data.

Thomas Bleher <thomasbleher>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by eggert (Posted a comment)
  • -unavailable- added by claudebrisson (Posted a comment)
  • -unavailable- added by thomasbleher (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1