Skip to content

Commit 99a74ef

Browse files
committed
Fix test_dylink_spaghetti
This test was inadvertently relying on an bug in llvm which was recently fixed: #13773 In this test the class `Class` is defined in both the main and the side module. If you run this code as is on the desktop the version of `Class` defined in `main.cpp` will always win the `side init` will never get printed. The fix is to give the class in the side module a different name (and alternative would be to put it in an anonymous namespace). This change should allow the llvm fix to roll in: https://reviews.llvm.org/D108413
1 parent d8ec08a commit 99a74ef

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tests/test_core.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -4463,14 +4463,21 @@ def test_dylink_spaghetti(self):
44634463
int side_x = -534;
44644464
int adjust2 = main_x + 10;
44654465
int *ptr2 = &main_x;
4466-
struct Class {
4467-
Class() {
4466+
struct SideClass {
4467+
SideClass() {
44684468
printf("side init sees %d, %d, %d.\n", adjust2, *ptr2, side_x);
44694469
}
44704470
};
4471-
Class cs;
4472-
''', expected=['side init sees 82, 72, -534.\nmain init sees -524, -534, 72.\nmain main sees -524, -534, 72.',
4473-
'main init sees -524, -534, 72.\nside init sees 82, 72, -534.\nmain main sees -524, -534, 72.'])
4471+
SideClass cs;
4472+
''', expected=['''\
4473+
side init sees 82, 72, -534.
4474+
main init sees -524, -534, 72.
4475+
main main sees -524, -534, 72.
4476+
''', '''\
4477+
main init sees -524, -534, 72.
4478+
side init sees 82, 72, -534.
4479+
main main sees -524, -534, 72.
4480+
'''])
44744481

44754482
@needs_make('mingw32-make')
44764483
@needs_dylink

0 commit comments

Comments
 (0)