-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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 >)’ before deduction of ‘auto’
msvc error: error C3779: 'hello': a function that returns 'decltype(auto)' cannot be used before it is defined
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.
Alan-FGRzerodefect
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working