Skip to content

[BUG] using N:namespace = ... suppress creation of struct for multiple return values #64

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

Closed
filipsajdak opened this issue Oct 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@filipsajdak
Copy link
Contributor

I know that namespaces are not supported yet by cppfront. Unfortunately, it can be added following the l-to-r approach, it compiles by cppfront but fails to compile by cpp1 compiler.

N: namespace = fun: () -> (a:int) = {
    a = 42;
    return;
}

Cppfront compiles fine but generates code that will not compile as it doesn't have a struct definition for multiple return values.

// ----- Cpp2 support -----
#include "cpp2util.h"



//=== Cpp2 definitions ==========================================================

   namespace N { [[nodiscard]] auto fun() -> fun__ret{
                       cpp2::deferred_init<int> a;
    a.construct(42);
    return  { std::move(a.value()) }; 
} }; 

https://godbolt.org/z/vr51TExGG

No definition of fun__ret.

Expected behavior: cppfront forbids namespaces/struct/class to be used like that or generates correct code.

@filipsajdak filipsajdak added the bug Something isn't working label Oct 9, 2022
Azmah-Bad pushed a commit to Azmah-Bad/cppfront that referenced this issue Feb 24, 2023
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

1 participant