Opened 11 years ago

Closed 11 years ago

#6323 closed Bugs (fixed)

Conflicting forward declarations with versioned namespace in libstdc++.

Reported by: Kohei Takahashi <flast@…> Owned by: Daniel James
Milestone: To Be Determined Component: hash
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

GCC says following error.

In file included from ./boost/functional/hash/hash.hpp:535:0,
                 from ./boost/functional/hash.hpp:6,
                 from ./boost/unordered/unordered_set.hpp:21,
                 from ./boost/unordered_set.hpp:16,
                 from ./boost/graph/adjacency_list.hpp:21,
                 from libs/python/src/object/inheritance.cpp:11:
./boost/functional/hash/extensions.hpp:34:33: error: template declaration of 'std::size_t boost::hash_value'
./boost/functional/hash/extensions.hpp:34:28: error: reference to 'pair' is ambiguous
./boost/detail/container_fwd.hpp:143:42: error: candidates are: template<class T1, class T2> struct std::pair
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.3/../../../../include/c++/4.6.3/bits/stl_pair.h:87:12: error:                 template<class _T1, class _T2> struct std::__7::pair
./boost/functional/hash/extensions.hpp:34:39: error: expected primary-expression before ',' token

This problem similar to #6287.

Change History (8)

comment:1 by Daniel James, 11 years ago

Component: Nonehash
Owner: set to Daniel James
Status: newassigned

Do you know if there's a way to detect when versioned namespaces are used?

comment:2 by pluto@…, 11 years ago

the <boost/container/container_fwd.hpp> should include <boost/detail/container_fwd.hpp> which handles BOOST_DETAIL_NO_CONTARINER_FWD macro that can be defined by users in such situation.

comment:3 by Daniel James, 11 years ago

I think you're a little confused, <boost/container/container_fwd.hpp> forward declares Boost's own implementation of the containers, not the ones in the std namespace. It's always fine for it to forward declare its own containers.

comment:4 by pluto@…, 11 years ago

on the 1.48.0 release the <boost/container/container_fwd.hpp> constains fwd decls for std:: elements and fwd decls for boost's containers and btw this is already fixed on trunk by:

------------------------------------------------------------------------
r76114 | igaztanaga | 2011-12-23 13:00:27 +0100 (Fri, 23 Dec 2011) | 1 line
Changed paths:
   M /trunk/boost/container/container_fwd.hpp
   M /trunk/boost/interprocess/interprocess_fwd.hpp

Bug #6287
------------------------------------------------------------------------

comment:5 by Daniel James, 11 years ago

OK, I had a look at the current trunk before writing so I missed that it was changed recently. But that's for #6287 and is irrelevant here anyway. This report is for an error which happens when <boost/detail/container_fwd.hpp> is included - you can see that from the error report. If there's some means by which versioned namespaces can be detected - typically by checking for a macro defined by the gcc standard library - then <boost/detail/container_fwd.hpp> can be changed to do the right thing automatically. Otherwise it'll probably have to be changed to just include all the relevant headers.

comment:6 by Daniel James, 11 years ago

(In [76444]) Unordered: Mark up new container forwarding failures. Refs #6323.

A lot of new failures because container forwading is now disabled for a lot of cases where it doesn't have to be.

comment:7 by Daniel James, 11 years ago

And previously: (In [76419]) Detail: Disable container forward declarations for recent versions of libstdc++.

comment:8 by Daniel James, 11 years ago

Resolution: fixed
Status: assignedclosed

(In [76529]) Detail: Merge disabled gcc container forwardings. Fixes #6323.

Note: See TracTickets for help on using tickets.