cppfront
cppfront copied to clipboard
[BUG] cppfront >v0.8 emit uncompilable C++ code
Describe the bug The simple hello example successfully processed by cppfront v0.7.3, but cppfront >v0.8.x emit uncompilable C++ code
To Reproduce Steps to reproduce the behavior:
- `main: () = { words: std::vector = ( "Alice", "Bob" ); hello( words[0] ); hello( words[1] ); }
hello: (msg: std::string_view) = std::cout << "Hello, (msg)$!\n";`
- Command lines including which C++ compiler you are using: cppfront hello.cpp2
- Expected result - what you expected to happen:
cppfront v0.7.3 generate:
auto hello(cpp2::impl::in<std::string_view> msg) -> void; - Actual result/error
cppfront v0.8.x generate:
[[nodiscard]] auto hello(cpp2::impl::in<std::string_view> msg) -> decltype(auto);
gcc error: error: use of ‘decltype(auto) hello(cpp2::impl::in<std::basic_string_view
Additional context
Issue can be simply fixed in cpp2 code like this:
hello: (msg: std::string_view) = { std::cout << "Hello, (msg)$!\n"; }
But this is very strange in my opinion.