[BUG] cpp2::move(std)::cout suddenly appears
Sorry but I won't be able to give much info as this bug seems to appear “randomly”.
Sometimes I'll add a valid line of code to a method and another function in my code (always the same) will start being generated in the wrong way.
It's impossible to reproduce this bug in an MRE, because it's incomprehensible. I once had this bug and adding this line count = count + 0;, in the method I was working on made it go away.
Sometime this method:
printMenu:() = {
clear();
std::cout << "**************************************************" << std::endl;
std::cout << "* GOPP2 Menu *" << std::endl;
std::cout << "**************************************************" << std::endl;
std::cout << "* Please select one of the following: *" << std::endl;
std::cout << "* *" << std::endl;
std::cout << "* 1. Start a game *" << std::endl;
std::cout << "* 2. Exit *" << std::endl;
std::cout << "**************************************************" << std::endl;
std::cout << std::endl << getNextMessage() << std::endl;
}
Is generated like this for no apparent reason:
auto printMenu() -> void{
clear();
std::cout << "**************************************************" << std::endl;
std::cout << "* GOPP2 Menu *" << std::endl;
std::cout << "**************************************************" << std::endl;
std::cout << "* Please select one of the following: *" << std::endl;
cpp2::move(std)::cout << "* *" << std::endl;
std::cout << "* 1. Start a game *" << std::endl;
std::cout << "* 2. Exit *" << std::endl;
std::cout << "**************************************************" << std::endl;
std::cout << std::endl << getNextMessage() << std::endl;
}
Why does cpp2::move(std)::cout is generated?
I don't have any explanation, I'll let you know if I get any new information on this.
I think I've found a solution to my problem. I mustn't run cppfront on all my files at the same time in my building script.
This generates cpp1 code that does not compile:
cppfront -cwd ./generate ../src/color.h2 |
cppfront -cwd ./generate `
../src/stone.h2 `
../src/goban.h2 `
../src/move.h2 `
../src/game.h2 `
../src/engine.h2 `
../src/io.h2 `
../src/main.cpp2 `
-import-std
While it generates the expected code
cppfront -cwd ./generate ../src/color.h2 |
cppfront -cwd ./generate ../src/stone.h2 ../src/goban.h2 ../src/move.h2 -import-std |
cppfront -cwd ./generate ../src/game.h2 ../src/engine.h2 ../src/io.h2 -import-std |
cppfront -cwd ./generate ../src/main.cpp2 -import-std
Sounds like an issue with globals usage.