[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#478734: g++-4.2: refuses to compile valid C++ syntax



Package: g++-4.2
Version: 4.2.3-4
Severity: grave
Justification: renders package unusable


g++ refuses to compile the following syntax commonly used to force a 
std::vector to release allocated memory:

  #include <vector>
  int main()
  {
    std::vector<int> v;
    v.clear();
    v.swap( std::vector<int>(v) );
    return 0;
  }

I emmits the following  error message:

bug.cc: In function 'int main()':
bug.cc:6: error: no matching function for call to 'std::vector<int, 
  std::allocator<int> >::swap(std::vector<int, std::allocator<int> >)'
/usr/include/c++/4.2/bits/stl_vector.h:728: note: candidates are: void 
  std::vector<_Tp, _Alloc>::swap(std::vector<_Tp, _Alloc>&) [with _Tp = 
  int, _Alloc = std::allocator<int>]



-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages g++-4.2 depends on:
ii  gcc-4.2                       4.2.3-4    The GNU C compiler
ii  gcc-4.2-base                  4.2.3-4    The GNU Compiler Collection (base 
ii  libc6                         2.7-10     GNU C Library: Shared libraries
ii  libstdc++6-4.2-dev            4.2.3-4    The GNU Standard C++ Library v3 (d

g++-4.2 recommends no packages.

-- no debconf information



Reply to: