ref15.c
来自「用于进行gcc测试」· C语言 代码 · 共 33 行
C
33 行
// PR c++/20416. We correctly constructed the temporary S in foo(),// but incorrectly destroyed it every time foo() was called.// { dg-do run }extern "C" void abort (void);extern "C" void _exit (int);int c, exiting;struct S { S() { ++c; } S(const S &) { ++c; } ~S() { if (!exiting) abort (); _exit (0); }};voidfoo (void){ static const S &s = S();}int main (){ if (c != 0) abort (); foo (); foo (); if (c != 1) abort (); exiting = 1; return 1;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?