cppfront
cppfront copied to clipboard
fix(to_cpp1): define type-scope object alias with wildcard type inline
trafficstars
Resolves #700. Resolves #842. Resolves #1221.
evens_doubled: @struct type = {
filter :== :(x: int) x % 2 == 0;
map :== :(x: int) x * 2;
}
currently emits to
/home/johel/tmp/Waarudo/ClangDebug/sources/main.cpp:23:42: error: expected expression
23 | public: static constexpr auto filter = public: [](cpp2::in<int> x) -> auto { return x % 2 == 0; };
| ^
/home/johel/tmp/Waarudo/ClangDebug/sources/main.cpp:23:33: error: declaration of variable 'filter' with deduced type 'const auto' requires an initializer
23 | public: static constexpr auto filter = public: [](cpp2::in<int> x) -> auto { return x % 2 == 0; };
| ^
/home/johel/tmp/Waarudo/ClangDebug/sources/main.cpp:24:39: error: expected expression
24 | public: static constexpr auto map = public: [](cpp2::in<int> x) -> auto { return x * 2; };
| ^
/home/johel/tmp/Waarudo/ClangDebug/sources/main.cpp:24:33: error: declaration of variable 'map' with deduced type 'const auto' requires an initializer
24 | public: static constexpr auto map = public: [](cpp2::in<int> x) -> auto { return x * 2; };
| ^
4 errors generated.
Commit a7ab29e0930a076655730b048b6d3f8faf867544 added a test I need to uncomment: https://github.com/hsutter/cppfront/commit/a7ab29e0930a076655730b048b6d3f8faf867544?diff=unified&w=1#diff-ae13b6b6670a9a734209e2ebb439bc244d45ad614d07206ef68545ed713f025aR15-R18.