aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/builtins3.C
blob: 4a67b28e969fccedb8f6d26d095fa3602ac282c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Test whether this builtin minimally works in G++.
// Origin: Kaveh Ghazi Jan 16, 2001
// Copyright (C) 2001 Free Software Foundation.
//
// Special g++ Options: -O2

namespace std 
{
  extern "C" void abort (void);
  extern "C" void *alloca (__SIZE_TYPE__);
}

int main ()
{
  using namespace std;
  void *foo;
  
  foo = alloca (32);
  if (!foo)
    abort ();

  foo = std::alloca (32);
  if (!foo)
    abort ();

  foo = ::__builtin_alloca (32);
  if (!foo)
    abort ();

  return 0;
}

extern "C"
{
  static void * ::alloca (__SIZE_TYPE__)
  {
    std::abort ();
  }
}