From 43c05503d2c60e2e520b06ad3f224ffbcd7756af Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Fri, 7 Jun 2024 23:52:07 +0200 Subject: [PATCH] add test --- test/ctl/optional_test.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/ctl/optional_test.cc b/test/ctl/optional_test.cc index de75ebe30..49133e7d9 100644 --- a/test/ctl/optional_test.cc +++ b/test/ctl/optional_test.cc @@ -26,6 +26,8 @@ // #include // #define ctl std +static int g = 0; + int main() { @@ -114,6 +116,13 @@ main() return 24; } + { + struct A { int* p = &g; A() {++*p; } }; + ctl::optional x; + if (g != 0) + return 25; + } + CheckForMemoryLeaks(); return 0; }