Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[BUG] cppfront >v0.8 emit uncompilable C++ code #1420

Open
Labels
bugSomething 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:

  1. `main: () = {
    words: std::vector = ( "Alice", "Bob" );
    hello( words[0] );
    hello( words[1] );
    }

hello: (msg: std::string_view) =
std::cout << "Hello, (msg)$!\n";`

  1. Command lines including which C++ compiler you are using: cppfront hello.cpp2
  2. Expected result - what you expected to happen:
    cppfront v0.7.3 generate: auto hello(cpp2::impl::in<std::string_view> msg) -> void;
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /