A
Andrey Dj
Hello!
I found some interesting case of non-compiling C++ code.
Look at first example:
--------------------------------
template<class T> void Foo(T*);
class Bar;
template<> void Foo(Bar*);
class Bar
{
friend void ::Foo<>(Bar*);
};
--------------------------------
Compiling... All fine.
Now add to Foo return type of Baz:
--------------------------------
class Baz {};
template<class T> Baz Foo(T*);
class Bar;
template<> Baz Foo(Bar*);
class Bar
{
friend Baz ::Foo<>(Bar*);
};
--------------------------------
Trying to compile:
MSVC: error C2039: 'Foo' : is not a member of 'Baz'
GCC: error: 'Foo' in class 'Baz' does not name a type
Is there any way to declare such friend partial specialization?
I found some interesting case of non-compiling C++ code.
Look at first example:
--------------------------------
template<class T> void Foo(T*);
class Bar;
template<> void Foo(Bar*);
class Bar
{
friend void ::Foo<>(Bar*);
};
--------------------------------
Compiling... All fine.
Now add to Foo return type of Baz:
--------------------------------
class Baz {};
template<class T> Baz Foo(T*);
class Bar;
template<> Baz Foo(Bar*);
class Bar
{
friend Baz ::Foo<>(Bar*);
};
--------------------------------
Trying to compile:
MSVC: error C2039: 'Foo' : is not a member of 'Baz'
GCC: error: 'Foo' in class 'Baz' does not name a type
Is there any way to declare such friend partial specialization?