Opened 13 years ago

Closed 12 years ago

#2993 closed Bugs (wontfix)

addressof warning in VC9

Reported by: Fredrik Orderud <fredrik.orderud@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: utility
Version: Boost Development Trunk Severity: Problem
Keywords: Cc: mateusz@…

Description

CONFIGURATION: Boost 1.39, Visual studio 2008 (VC9), WARNING LEVEL 4 (most verbose).

PROBLEM: When iterating over a std::vector<int> with BOOST_FOREACH, the compiler returns a "warning C4512: 'boost::detail::addr_impl_ref<T>' : assignment operator could not be generated". This warning did not appear with boost 1.38.

#pragma once
#include <vector>
#include <iostream>
#include <boost/foreach.hpp>

// Compile with warning level 4:
int main () {
	std::vector<int> list;
	// warning C4512: 'boost::detail::addr_impl_ref<T>' : assignment operator could not be generated
	BOOST_FOREACH (const int & e, list) {
		std::cout << e << std::endl;
	}
	return 0;
}

Attachments (1)

addressof.hpp.patch (391 bytes ) - added by Eric Niebler 13 years ago.
patch to eliminate noisy warning on VC++

Download all attachments as: .zip

Change History (6)

by Eric Niebler, 13 years ago

Attachment: addressof.hpp.patch added

patch to eliminate noisy warning on VC++

comment:1 by Eric Niebler, 13 years ago

Component: foreachutility
Owner: changed from Eric Niebler to Peter Dimov
Summary: BOOST_FOREACH warning in VC9addressof warning in VC9

This warning is actually coming from addressof.hpp, so I'm reassigning and attaching a very simple patch. Peter, I can commit this if you approve.

comment:2 by Peter Dimov, 13 years ago

Yes, please commit and merge to release.

comment:3 by Daniel James, 13 years ago

Resolution: fixed
Status: newclosed

This was merged to release in [53054].

comment:4 by Mateusz Loskot, 12 years ago

Cc: mateusz@… added
Milestone: Boost 1.39.0To Be Determined
Resolution: fixed
Status: closedreopened
Version: Boost Development Trunk

It seems sensible to declare hidden private copy constructor as well

addr_impl_ref(const addr_impl_ref &);

comment:5 by Peter Dimov, 12 years ago

Resolution: wontfix
Status: reopenedclosed
Note: See TracTickets for help on using tickets.