G
gugdias
I'm coding a simple matrix class, which is resulting in the following
error when compiling with g++ 3.4.2 (mingw-special):
* declaration of `operator/' as non-function
* expected `;' before '<' token
<snip>
---------------------------------------------------
template <class T>
class matriz;
matriz<T> operator+ (const T&, const matriz<T>&);
template <class T>
matriz<T> operator- (const T&, const matriz<T>&);
template <class T>
matriz<T> operator* (const T&, const matriz<T>&);
template <class T>
matriz<T> operator/ (const T&, const matriz<T>&);
template <class T>
class matriz
{
private:
...
class linha
{
code of nested function...
};
public:
...
matriz<T> operator+ (const matriz<T>&) const;
matriz<T> operator- (const matriz<T>&) const;
matriz<T> operator* (const matriz<T>&) const;
friend matriz<T> operator+ <> (const T&, const matriz<T>&);
friend matriz<T> operator- <> (const T&, const matriz<T>&);
friend matriz<T> operator* <> (const T&, const matriz<T>&);
friend matriz<T> operator/ <> (const T&, const matriz<T>&);
};
---------------------------------------------------
</snip>
The problem is only with the operator/, which is being declared
identical to the others. What is odd is that when i add this
declaration:
matriz<T> operator/ (const matriz<T>&) const;
it compiles without errors.
Does it appear to be a bug in g++?
error when compiling with g++ 3.4.2 (mingw-special):
* declaration of `operator/' as non-function
* expected `;' before '<' token
<snip>
---------------------------------------------------
template <class T>
class matriz;
matriz<T> operator+ (const T&, const matriz<T>&);
template <class T>
matriz<T> operator- (const T&, const matriz<T>&);
template <class T>
matriz<T> operator* (const T&, const matriz<T>&);
template <class T>
matriz<T> operator/ (const T&, const matriz<T>&);
template <class T>
class matriz
{
private:
...
class linha
{
code of nested function...
};
public:
...
matriz<T> operator+ (const matriz<T>&) const;
matriz<T> operator- (const matriz<T>&) const;
matriz<T> operator* (const matriz<T>&) const;
friend matriz<T> operator+ <> (const T&, const matriz<T>&);
friend matriz<T> operator- <> (const T&, const matriz<T>&);
friend matriz<T> operator* <> (const T&, const matriz<T>&);
friend matriz<T> operator/ <> (const T&, const matriz<T>&);
};
---------------------------------------------------
</snip>
The problem is only with the operator/, which is being declared
identical to the others. What is odd is that when i add this
declaration:
matriz<T> operator/ (const matriz<T>&) const;
it compiles without errors.
Does it appear to be a bug in g++?