Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Errors #12

Open
jessicah opened this issue Sep 10, 2021 · 0 comments
Open

Compilation Errors #12

jessicah opened this issue Sep 10, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jessicah
Copy link

jessicah commented Sep 10, 2021

First, std::exception doesn't have a constructor taking const char *; I fixed this by subclassing std::runtime_error instead, as suggested at https://en.cppreference.com/w/cpp/error/exception/exception:

The Microsoft implementation includes non-standard constructors taking strings thus allowing instances to be thrown directly with a meaningful error message. The nearest standard equivalents are std::runtime_error or std::logic_error.

Running into (added flag to treat as warning):
MyTokenizer.cpp: warning: ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say &MyTokenizer::MyTokenizer::actionRegister105 [-fpermissive]

And then, trying to use the example documentation to make my stuff run...

	TextFileStream tfs("Testfile");

	MyTokenizer::MyTokenizer myTokenizer;
	auto tokenizedStream = myTokenizer.processStreamWithIgnorance(tfs);

	auto processedStream(tokenizedStream);
	
	MyParser::MyParser myParser;
	auto parsedStream = myParser.parseStream(processedStream);

gives

main.cpp: In function ‘int main()’:
main.cpp:77:44: error: cannot convert ‘std::__cxx11::list<std::shared_ptr<MyTokenizer::MyTokenizerTerminal>, std::allocator<std::shared_ptr<MyTokenizer::MyTokenizerTerminal> > >’ to ‘ProductionStream<MyTokenizer::MyTokenizerTerminal>&’
   77 |  auto parsedStream = myParser.parseStream(processedStream);
      |                                            ^~~~~~~~~~~~~~~
      |                                            |
      |                                            std::__cxx11::list<std::shared_ptr<MyTokenizer::MyTokenizerTerminal>, std::allocator<std::shared_ptr<MyTokenizer::MyTokenizerTerminal> > >
In file included from MyParser.h:15,
                 from main.cpp:15:
Parser.h:71:133: note:   initializing argument 1 of ‘std::__cxx11::list<std::shared_ptr<_Tp> > Parser<InputStreamType, OutputProductionType>::parseStream(InputStreamType&) [with InputStreamType = ProductionStream<MyTokenizer::MyTokenizerTerminal>; OutputProductionType = Production]’
   71 | inline std::list<std::shared_ptr<OutputProductionType>> Parser<InputStreamType, OutputProductionType>::parseStream(InputStreamType& rs) {
      |                                                                                                                    ~~~~~~~~~~~~~~~~~^~

It seems like perhaps ListProductionStream template class is meant to be used somewhere, but I haven't been able to figure out what needs changing.

Building with g++ 9.3.0 and current master.

@lexected lexected self-assigned this Apr 10, 2022
@lexected lexected added the bug Something isn't working label Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants