]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Mon, 17 Jun 2002 00:29:37 +0000 (00:29 +0000)
committerNo Author <no-author@gcc.gnu.org>
Mon, 17 Jun 2002 00:29:37 +0000 (00:29 +0000)
'gcc-3_1-branch'.

From-SVN: r54688

gcc/testsuite/g++.dg/opt/inline3.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/opt/inline3.C b/gcc/testsuite/g++.dg/opt/inline3.C
new file mode 100644 (file)
index 0000000..7199de0
--- /dev/null
@@ -0,0 +1,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);
+}