Crafter.Build/tests/IncrementalInterfaceChange/fixture/main.cpp

17 lines
663 B
C++
Raw Normal View History

// SPDX-License-Identifier: LGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
import std;
import Widget;
// Prints "<size the consumer was compiled against> <size the library was
// compiled against>" and exits 1 when they disagree. A mismatch is the
// observable form of the mixed-layout binary a stale consumer object produces —
// this reports it instead of waiting for the SIGSEGV that the real-world case
// (issue #27) produced in a destructor.
int main() {
std::size_t here = sizeof(Widget);
std::size_t inLibrary = WidgetSizeInLibrary();
std::print("{} {}", here, inLibrary);
return here == inLibrary ? 0 : 1;
}