This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Possible compilation failure in tr1/hashtable?
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Francesco Biscani <bluescarni at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 09 Jan 2008 05:17:22 +0100
- Subject: Re: Possible compilation failure in tr1/hashtable?
- References: <47843B93.1040005@gmail.com>
Hi Francesco,
> Hello,
>
> I don't know if this is a bug, but I spotted it with ICC. It is about a
> friend declaration in tr1/hashtable, which references a struct declared
> in tr1/hashtable_policy.h with a different number of template arguments.
Actually, there are also specializations with the exact number of
template arguments (3), and we are interested in granting access to
those... We can probably apply the patch (apparently doesn't hurt in
GCC) but the issue seems really a subtle one about friendship across
namespaces. To be safe, I would ask you to check Bugzilla (I think we
have already something about that) and in case, file a DR saying that
something like the below compiles with ICC and doesn't with GCC:
Thanks,
Paolo.
//////////////////
namespace detail
{
template<typename A, typename B>
class one;
template<typename C>
class one<int, C>;
}
template<typename T>
class two
{
template<typename A /* , typename B */>
friend class detail::one;
int num;
};
namespace detail
{
template<typename C>
struct one<int, C>
{
void f()
{
two<int> t;
t.num = 1;
}
};
}
int main()
{
detail::one<int, double> o;
o.f();
}