g++ and -Weffc++ : why this warning for operator++() in nestedtemplate class?

W

wimalopaan

Hi,

in the following example

template<typename T>
class A {
public:
class B {
public:
B& operator++();
};
};

template<typename T>
typename A<T>::B& A<T>::B::eek:perator++() {
return *this;
}

I get a warning


In file included from cvl0001.cc:1:
a.h:14: warning: prefix ‘typename A<T>::B& A<T>::B::eek:perator++()’
should return ‘A<T>::B&’

Well, if define the op++() inside the nested template class B, all is
fine ...

What's wrong here?
 
B

bartek szurgot

Hi,

in the following example

template<typename T>
class A {
public:
class B {
public:
B& operator++();
};
};

template<typename T>
typename A<T>::B& A<T>::B::eek:perator++() {
return *this;
}

I get a warning


In file included from cvl0001.cc:1:
a.h:14: warning: prefix ‘typename A<T>::B& A<T>::B::eek:perator++()’
should return ‘A<T>::B&’

Well, if define the op++() inside the nested template class B, all is
fine ...

What's wrong here?

got the same with g++ versions 4.3 and 4.4. versions 4.5 and 4.6 do not
complain so it looks like old-g++ problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top