Pointer to non-const std::string in position and location should be a pointer to const std::string

Yuriy Solodkyy <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <[email protected]>
Hi,

I’m using bison 3.6.3 on MacOS via brew. I see that in the C++ generated parser location and position take pointer to std::string with filename via a pointer to modifiable std::string. I don’t see the filename itself being modified anywhere in the parser, so I was wondering why not accept a pointer to const std::string instead? Without this, I need to either copy filename first somewhere or const_cast when I can ensure the lifetime. The thing is that when I invoke my own function passing it a filename in const string&, which in turn calls parse (in pull mode) I can ensure that the filename will be valid during the entire duration of the call to parse yet I cannot use a pointer to it to initialize location because location demands the pointer to non-const string, which in my opinion is unnecessary. Can you please change your source for position and location take pointer to const std::string instead?

Thank you!
Yuriy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.