Possible compilation failure in tr1/hashtable?
Paolo Carlini
pcarlini@suse.de
Wed Jan 9 04:17:00 GMT 2008
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();
}
More information about the Libstdc++
mailing list