new1.c

来自「Mac OS X 10.4.9 for x86 Source Code gcc」· C语言 代码 · 共 46 行

C
46
字号
// { dg-do run }// { dg-options "-O2" }// Copyright (C) 2004 Free Software Foundation, Inc.// Contributed by Nathan Sidwell 2 Dec 2004 <nathan@codesourcery.com>// PR 18318. ICE with template new[]// Origin:Elliot Hughes <enh@jessies.org>// Andrew Pinski <pinskia@gcc.gnu.org>struct Aint{  ~Aint ();  Aint ();};Aint::Aint () {}Aint::~Aint () {}static int count;template <class T>struct A{  unsigned Blksize() const;    void f()  {    new T[Blksize()];  }};template <class T> unsigned A<T>::Blksize () const{  count++;  return 1;}int main (){  A<Aint> a;  a.f();    return count != 1;}

⌨️ 快捷键说明

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