19 lines
685 B
C++
19 lines
685 B
C++
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
||
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||
|
|
|
||
|
|
// Consumer of the layout under test. `Thing` lives on the stack here, so a
|
||
|
|
// stale object file that still believes the old `sizeof(Payload)` lets the
|
||
|
|
// library's Fill() write past what this frame reserved. Reports the disagreement
|
||
|
|
// as a non-zero exit rather than relying on the corruption to fault.
|
||
|
|
import Widget;
|
||
|
|
import std;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
Demo::Thing thing;
|
||
|
|
thing.Fill();
|
||
|
|
std::println("first={} tail={} sizeof={}", thing.payload.first, thing.tail, sizeof(Demo::Thing));
|
||
|
|
if (thing.payload.first != 11 || thing.tail != 7) {
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
}
|