Skip to content

Conversation

@smanders
Copy link

cp .devcontainer/cmake/presets/CMakePresets* .
CMake Error at CMakeLists.txt:39 (add_library):
  add_library cannot create ALIAS target "GTest::gtest" because another
  target with the same name already exists.

`add_subdirectory(third_party/gtest EXCLUDE_FROM_ALL)` defines the alias target
Address Clang warnings in the test suite without weakening the test
coverage:

- LuaRefTests.Assignment:
  Avoid -Wself-assign-overloaded by assigning from a copy of LuaRef
  instead of using literal `value = value;`, while still verifying that
  assignment preserves the value.

- PerformanceTests:
  Add a virtual destructor to struct A so Clang no longer warns about
  deleting a polymorphic type without a virtual destructor.

- RefCountedObjectTests.AssignOperatorRefSelfAssignment
  RefCountedPtrTests.AssignOperatorRefSelfAssignment:
  Restore true self-assignment tests for RefCountedObjectPtr and
  RefCountedPtr, but wrap the self-assignment line in Clang diagnostic
  pragmas that temporarily disable -Wself-assign-overloaded.

These changes keep the original semantics of the tests intact while
allowing Release builds with -Wall -Werror under Clang to pass cleanly.
Wrap weak_ptr expiration checks in StdFunctions-related tests with a
LUABRIDGE_CHECK_STDFUNCTION_LIFETIME guard.

This keeps the behavioral checks that:
- std::function-based methods/properties are callable from Lua, and
- their shared_ptr captures remain alive while Lua holds them,

but stops requiring that captured shared_ptrs expire immediately after
lua_close() on all platforms.

Strict lifetime checking can still be enabled by defining
LUABRIDGE_CHECK_STDFUNCTION_LIFETIME when building the tests.
@smanders smanders merged commit a7874de into dev Nov 18, 2025
8 checks passed
@smanders smanders deleted the xpro branch November 18, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants