Closed wolfseifert closed 4 months ago
I believe this issue can be fixed. The most recent version generates the expected c++:
std::cout << cpp2::impl::as_<int>(a) << std::endl;
std::cout << cpp2::impl::as_<int>(cpp2::move(a)) << std::endl;
I can confirm that the transpiler output changed to:
#define CPP2_IMPORT_STD Yes #include "cpp2util.h" auto main() -> int; auto main() -> int{ std::any a {1}; std::cout << cpp2::impl::as_(a) << std::endl; std::cout << cpp2::impl::as_ (cpp2::move(a)) << std::endl; }
but trying to compile still gives:
anys.cpp:10:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream'} and 'const cpp2::nonesuch_') 10 | std::cout << cpp2::impl::as_ (a) << std::endl; | ~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | const cpp2::nonesuch_ | std::ostream {aka std::basic_ostream }
Ah, my bad. I'll see what I can do to fix it.
Thanks! This should now be fixed with the above commit, please check.
After pulling in 510eae80bf3b92c7e210817c329e4b417d0012ec:
transpiles to
but does not compile