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