summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/inline3.C
blob: 7199de09c0ab96a30bfac469765918501166d773 (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
40
// PR opt/6793
// We failed to supress inlining of a varargs function when it's a template.
// { dg-do compile }
// { dg-options "-O3" }

#include <stdarg.h>

typedef __SIZE_TYPE__ size_t;

template < class Type > class VectorNd
{
  size_t size;
  Type *data;
 public:

  VectorNd (size_t _size, size_t count, ...)
	: size (_size)
  {
    data = new Type[size];

    va_list ap;

    va_start (ap, count);

    for (size_t i = 0; i < count; i++)
      data[i] = va_arg (ap, Type);

    va_end (ap);
  }

  ~VectorNd ()
  {
    delete [] data;
  }
};

int main ()
{
  VectorNd <double> vector (3, 3, 1.0, 2.0, 3.0);
}