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

Bug#478734: marked as done (g++-4.2: refuses to compile valid C++ syntax)



Your message dated Thu, 1 May 2008 12:20:35 -0400
with message-id <20080501162035.GA2828@caradoc.them.org>
and subject line Re: Bug#478734: g++-4.2: refuses to compile valid C++ syntax
has caused the Debian Bug report #478734,
regarding g++-4.2: refuses to compile valid C++ syntax
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
478734: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=478734
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
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



--- End Message ---
--- Begin Message ---
On Thu, May 01, 2008 at 11:07:03AM -0500, Jason Kraftcheck wrote:
> The same syntax is accepted by the only other C++ compiler I have access  
> too: Sun's.  I guess what I don't understand is why, if I create a  
> temporary by explicitly calling the copy constructor, that temporary is  
> treated as an rvalue.

Explicitly invoking the copy constructor is, as far as I understand
it, considered a cast to the same type.  Casts always produce rvalues.
It's initializer context that is special, not the copy constructor.

It was probably accepted by GCC 3.3, also.  When the parser was
rewritten in GCC 3.4 it was made much stricter about language
conformance.

I'm not an actual C++ expert; I just work with enough of them that
it rubs off.  Feel free to seek confirmation elsewhere and reopen.

-- 
Daniel Jacobowitz
CodeSourcery


--- End Message ---

Reply to: