http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53403
Bug #: 53403
Summary: Function template friend denied access to private
types of granting template class.
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following code compiles with GCC 4.4 but not since 4.5, until at least
4.7.0.
template <typename T>
class Foo {
typedef void type;
template <typename U> friend void f();
public:
Foo() {}
};
template class Foo<void>;
template <typename T>
void f()
{
typedef Foo<void>::type type;
}
int main()
{
f<void>();
}
If the function template is declared before the definition of the class
template, or if the Foo<void> class is instantiated after f's definition, the
code compiles. The error appears only with private types, not other private
members.
Easy to work around, but still... :/