Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > typedefs, qualified identifiers, class names and name lookup

Reply
Thread Tools

typedefs, qualified identifiers, class names and name lookup

 
 
Ivan A. Kosarev
Guest
Posts: n/a
 
      01-13-2006
Hello,

There are three similar programs below. All of these use typedef names,
qualified identifiers, class names and name lookup mechanism in various
contexts. I found that most respect C++ compilers differ significantly in
interpreting the code. So, could anyone pick a correct behavior a conformant
compiler should follow for each of the cases?

Please note that I used the following compilers and command-line options:

EDG 3.6 --strict
MSVC 13.10.3077 /Za
GCC 3.4.4 --ansi

Thank you.

// 1
class C {
public:
int f();
};

int main() {
typedef C T;
C c;

// EDG MSVC GCC
c.~T(); // ok ok ok
c.T::~T(); // ok ok ok
c.T::C::f(); // ok fails ok
c.T::T::f(); // fails fails fails
}

// 2
class C {
public:
typedef int T;
int f();
};

int main() {
typedef C T;
C c;

// EDG MSVC GCC
c.~T(); // ok ok fails
c.T::~T(); // ok fails fails
c.T::C::f(); // ok fails fails
c.T::T::f(); // fails fails fails
}


// 3
class T {
public:
int f();
};

class C : public T {
public:
typedef int T;
};

int main() {
typedef C T;
C c;

// EDG MSVC GCC
c.~T(); // ok ok fails
c.T::~T(); // fails ok fails
c.T::C::f(); // fails fails fails
c.T::T::f(); // fails fails fails
}


--
Unicals Group -- Development Tools for OEMs
http://www.unicals.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
qualified member name lookup vanyacpp@gmail.com C++ 3 09-18-2012 07:05 AM
Not-quite-the-module-name qualified names in extension modules? What? Alf P. Steinbach /Usenet Python 0 07-10-2010 05:38 PM
Are fully qualified class names permitted for ctor declarations? winkerbean C++ 2 10-28-2008 03:51 PM
Pointer to qualified poitner to qualified object Szabolcs Borsanyi C Programming 13 06-08-2008 07:52 PM
qualified name VS unqualified name in class template. Wayne Shu C++ 4 03-12-2007 01:36 PM



Advertisments