badopt1.c

来自「linux下编程用 编译软件」· C语言 代码 · 共 17 行

C
17
字号
// { dg-do run  }// { dg-options "-O2" }// Based on a testcase by Bryan Weston <bryanw@bluemoon.sps.mot.com>// egcs 1.1 fails to increment countstruct Base { Base() {} }; // removing the constructor fixes the problemstruct Derived : Base {}; // so does removing the base classint main() {  int count = 0;  Derived* array[1]; // making this Base*[1] does not fix the problem  array[count++] = new Derived (); // but then new Base() does  if (count!=1)    return 1;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?