P
Paul J. Lucas
Given:
template<typename T> class outer {
public:
class assigner {
public:
assigner& operator=( T const& );
private:
assigner( int index ) : m_index( index ) { }
int const m_index;
friend class outer;
};
assigner operator[]( int i ) {
return assigner( i );
}
};
template<typename T> inline outer<T>::assigner& // line 17
outer<T>::assigner:perator=( T const &value ) {
// ...
return *this;
}
I get:
foo.cpp:17: error: expected initializer before '&' token
using g++ 4.1.2. If I de-template the code, it compiler without error.
So, is this a g++ bug?
- Paul
template<typename T> class outer {
public:
class assigner {
public:
assigner& operator=( T const& );
private:
assigner( int index ) : m_index( index ) { }
int const m_index;
friend class outer;
};
assigner operator[]( int i ) {
return assigner( i );
}
};
template<typename T> inline outer<T>::assigner& // line 17
outer<T>::assigner:perator=( T const &value ) {
// ...
return *this;
}
I get:
foo.cpp:17: error: expected initializer before '&' token
using g++ 4.1.2. If I de-template the code, it compiler without error.
So, is this a g++ bug?
- Paul