cppfront
cppfront copied to clipboard
[BUG] using N:namespace = ... suppress creation of struct for multiple return values
trafficstars
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.