Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.pt/vaarg2.C

raw
1 // { dg-do assemble }
2 // Copyright (C) 2000 Free Software Foundation
3 // Contributed by Nathan Sidwell 22 June 2000 <[email protected]>
4
5 // Origin GNATS bug report 63 from Kurt Garloff <[email protected]>
6 // We attempted to expand va_arg prematurely in a template function.
7
8 #include <stdarg.h>
9
10 template <class Type>
11 void PrintArgs (Type somearg, ...)
12 {
13 va_list argp;
14 va_start (argp, somearg);
15 Type value;
16 while ( ( value = va_arg (argp, Type) ) > 0.0)
17 continue;
18 va_end (argp);
19 }
20
21 int main (void)
22 {
23 double dummy = 0;
24 PrintArgs (dummy, 1.0, 2.0, 3.0, -1.0);
25 return 0;
26 }