Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2643 closed Bugs (fixed)

Warning C4224 in reversible_ptr_container and hash

Reported by: Paul A. Bristow Owned by: Daniel James
Milestone: Boost 1.38.0 Component: hash
Version: Boost 1.37.0 Severity: Cosmetic
Keywords: hash warnings Cc:

Description

I'm getting lots of warnings from reversible_ptr_container.hpp and has.hpp

warning C4224: nonstandard extension used : formal parameter 'array' was previously defined as a type

boost/functional/hash/hash.hpp formal parameter 'array' was previously defined as a type boost/ptr_container/detail/reversible_ptr_container.hpp C4224: nonstandard extension used : formal parameter 'hash' was previously defined as a type.

Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM (warning level 3 up)

Choice of names seems to clash. If this is troublesome to change, it would be convenient to disable warnings for MSVC with push'n'pop as this generates a great pile of warning text.

Change History (6)

comment:1 by Daniel James, 14 years ago

Status: newassigned

I can probably change the parameter name 'array', but it'd be really helpful if you could post a small example that triggers the warning, as I don't understand why it's a nonstandard extension.

The warning in reversible_ptr_container.hpp will need to be fixed in the ptr_container library, so you should create a separate ticket for that.

in reply to:  1 comment:2 by Paul A. Bristow, 14 years ago

Replying to danieljames:

I can probably change the parameter name 'array', but it'd be really helpful if you could post a small example that triggers the warning, as I don't understand why it's a nonstandard extension.

This comes from very deep within code, so I have no idea how to create a simple example. The complaint is

"formal parameter 'array' was previously defined as a type."

I suspect reusing the name is not allowed by the Standard? But compilers permit it. I recommend disabling the warning in this code unit if a name change looks dodgy.

The warning in reversible_ptr_container.hpp will need to be fixed in the ptr_container library, so you should create a separate ticket for that.

I have created a new ticket for ptr_container #2644 making a similar complaint.

comment:3 by Daniel James, 14 years ago

Okay, I've looked into this (http://msdn.microsoft.com/en-us/library/wh722488.aspx) and I wasn't getting a warning because I wasn't using the /Za flag. With it, I get the warning for:

#include <boost/array.hpp>
#include <boost/functional/hash/hash.hpp>

int main() {}

The warning seems dubious to me, but I'll change the parameter name.

comment:4 by Daniel James, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [50514]) Rename parameter to avoid Visual C++ warning about clash with boost::array.

Fixes #2643

comment:5 by Paul A. Bristow, 14 years ago

Seems to do the trick for hash - Thanks.

(but ptr_container still produces lots of warnings - see #2644)

comment:6 by Daniel James, 14 years ago

(In [50528]) Rename parameter to avoid Visual C++ warning about clash with boost::array.

Merged revisions 50514 via svnmerge from https://svn.boost.org/svn/boost/trunk

........

r50514 | danieljames | 2009-01-08 13:37:33 +0000 (Thu, 08 Jan 2009) | 3 lines

Rename parameter to avoid Visual C++ warning about clash with boost::array.

Fixes #2643

........

Note: See TracTickets for help on using tickets.