Open
Description
Description
I upgraded my Xcode from 16.2 to 16.4, and now the same code will not compile.
The errors:
error: invalid application of 'sizeof' to an incomplete type
note: forward declaration of ...
I am using the imgui C++ library.
Was there a change to how the Swift compiler does C++ interop? Should I be setting something in particular in my Swift PM config file? Should it be possible to compile imgui with the C++ interop?
Swift 6 16.4 compile error, copied from xcode build:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/x/Sources/cxx_lib_imgui/include/backends/imgui_impl_glfw.h"
^
/x/Sources/cxx_lib_imgui/include/backends/imgui_impl_glfw.h:27:10: note: in file included from /x/Sources/cxx_lib_imgui/include/backends/imgui_impl_glfw.h:27:
#include "imgui.h" // IMGUI_IMPL_API
^
/x/Sources/cxx_lib_imgui/include/imgui.h:2164:142: error: invalid application of 'sizeof' to an incomplete type 'ImGuiDockNodeSettings'
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); if (src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
^
/x/Sources/cxx_lib_imgui/include/imgui.h:2164:25: note: in instantiation of member function 'ImVector<ImGuiDockNodeSettings>::operator=' requested here
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); if (src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
^
/x/Sources/cxx_lib_imgui/include/imgui_internal.h:154:8: note: forward declaration of 'ImGuiDockNodeSettings'
struct ImGuiDockNodeSettings;
^
/x/Sources/cxx_lib_imgui/include/imgui.h:2164:142: error: invalid application of 'sizeof' to an incomplete type 'ImGuiDockRequest'
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); if (src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
^
/x/Sources/cxx_lib_imgui/include/imgui.h:2164:25: note: in instantiation of member function 'ImVector<ImGuiDockRequest>::operator=' requested here
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); if (src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
^
/x/Sources/cxx_lib_imgui/include/imgui_internal.h:152:8: note: forward declaration of 'ImGuiDockRequest'
struct ImGuiDockRequest;
^
imgui_internal.h:
struct ImGuiDockNodeSettings;
imgui.cpp:
struct ImGuiDockNodeSettings
{
ImGuiID ID;
ImGuiID ParentNodeId;
ImGuiID ParentWindowId;
ImGuiID SelectedTabId;
signed char SplitAxis;
char Depth;
ImGuiDockNodeFlags Flags;
ImVec2ih Pos;
ImVec2ih Size;
ImVec2ih SizeRef;
ImGuiDockNodeSettings() { memset(this, 0, sizeof(*this)); SplitAxis = ImGuiAxis_None; }
};
Thanks, any help much appreciated.
Reproduction
None
Expected behavior
Compiled ok, runs the code.
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0
Additional information
No response