What does the standard say about this code?

E

Evan

I have some code that I don't understand the implications of. GCC
4.6.1 (and the earlier versions I've tried) accept it, but EDG does
not (specifically, I've tried with Comeau's online front end and Intel
CC 11.0).

I'm quite familiar with some of the weird name lookup issues that
arise when templates and dependent names are involved, but at least I
would argue that they shouldn't apply in this case. Is it a defect in
EDG that it rejects it, a defect in GCC that accepts it, or one of
those places where the code isn't compliant but compliers aren't
required to issue a diagnostic?

EDG reports:
error: declaration is incompatible with
"ref_ptr<Wrapper<T>::control> Wrapper<T>::control::alpha()" (declared
at line 9)
Wrapper<T>::control::alpha()

in this code:
template< typename T >
class ref_ptr {
};

template <typename T>
class Wrapper {
class control {
public:
static ref_ptr<control> alpha();
};
typedef ref_ptr<control> controlRefPtr;
};

template <typename T>
typename Wrapper<T>::controlRefPtr
Wrapper<T>::control::alpha()
{
}
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top