This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16041] New: second parameter of `va_start' not last named argument


Current CVS mainline generate invalid warnings:
---8X----------------
test.cc: In function `std::vector<T*, std::allocator<T*> > make_vector
(T*, ...) [with T = B]':
test.cc:20:   instantiated from here
test.cc:7: warning: second parameter of `va_start' not last named argument
test.cc:7: warning: second parameter of `va_start' not last named argument
---X8----------------

for code:

---8X----------------
#include <cstdarg>
#include <vector>

template<typename T>
inline std::vector<T*> make_vector(T* a, ...) {
  va_list Args;
  va_start(Args, a);
  std::vector<T*> r;
  r.push_back(a);
  while (T* v = va_arg(Args, T*))
    r.push_back(v);
  va_end(Args);
  return r;
}

struct B {};

int main() {
  B b;
  make_vector<B>(&b,&b,0);
  return 0;
}
---X8----------------

-- 
           Summary: second parameter of `va_start' not last named argument
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wanderer at rsu dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-freebsd5.1
  GCC host triplet: i386-unknown-freebsd5.1
GCC target triplet: i386-unknown-freebsd5.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16041


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]