Skip to content

Commit 95e7b00

Browse files
Minimal example of a bug from cppyy
That needs to be fixed at CppInterOp reference: look at comments at compiler-research/cppyy-backend#116
1 parent f794dee commit 95e7b00

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

unittests/CppInterOp/VariableReflectionTest.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,39 @@ TEST(VariableReflectionTest, DatamembersWithAnonymousStructOrUnion) {
139139
#endif
140140
}
141141

142+
TEST(VariableReflectionTest, GetTypeAsString) {
143+
if (llvm::sys::RunningOnValgrind())
144+
GTEST_SKIP() << "XFAIL due to Valgrind report";
145+
146+
std::string code = R"(
147+
namespace my_namespace {
148+
149+
struct Container {
150+
int value;
151+
};
152+
153+
struct Wrapper {
154+
Container item;
155+
};
156+
157+
}
158+
)";
159+
160+
Cpp::CreateInterpreter();
161+
EXPECT_EQ(Cpp::Declare(code.c_str()), 0);
162+
163+
Cpp::TCppScope_t wrapper =
164+
Cpp::GetScopeFromCompleteName("my_namespace::Wrapper");
165+
EXPECT_TRUE(wrapper);
166+
167+
std::vector<Cpp::TCppScope_t> datamembers;
168+
Cpp::GetDatamembers(wrapper, datamembers);
169+
EXPECT_EQ(datamembers.size(), 1);
170+
171+
EXPECT_EQ(Cpp::GetTypeAsString(Cpp::GetVariableType(datamembers[0])),
172+
"my_namespace::Container");
173+
}
174+
142175
TEST(VariableReflectionTest, LookupDatamember) {
143176
std::vector<Decl*> Decls;
144177
std::string code = R"(

0 commit comments

Comments
 (0)