cppyy
cppyy copied to clipboard
STL PMR data structures are not correctly parsed
Cppyy seems to fail to correctly handle the PMR type aliases for both Unordered and ordered STL maps when either the key or value also contains the PMR namespace. Below are test cases which seem to fail.
def test_cppyy_pmr():
try:
cppyy.gbl.__cppyy_testing.TestObjectPmr
except:
cppyy.cppdef(
"""
#include <memory_resource>
#include <string>
#include <memory>
#include <unordered_map>
#include <map>
#include <cstdint>
namespace __cppyy_testing {
struct TestObjectPmr {
struct NestedDummyObject {
std::int32_t id;
};
std::pmr::unordered_map<std::pmr::string, std::unique_ptr<NestedDummyObject>> umap;
std::pmr::unordered_map<std::string, std::shared_ptr<NestedDummyObject>> map;
};
}
"""
)
obj = cppyy.gbl.__cppyy_testing.TestObjectPmr()
umap ends up with the incorrect type of cppyy.gbl.std.unordered_map<std::stringtd::pmr::polymorphic_allocator<char>,std::unique_ptr<__cppyy_testing::TestObjectPmr::N...jectPmr::NestedDummyObject,std::default_delete<__cppyy_testing::TestObjectPmr::NestedDummyObject>>>>> where std::pmr::string is malformed.
map has the correct type but I cannot seem to insert any data into the map