Re: Problems since migrating to xcode 2
Re: Problems since migrating to xcode 2
- Subject: Re: Problems since migrating to xcode 2
- From: Chris Espinosa <email@hidden>
- Date: Wed, 25 May 2005 21:03:35 -0700
This is almost FAQ #! for gcc 4.0 for C++ users and is covered in some detail in the gcc 4.0 Release Notes:
What you're looking for is this:
GCC 4.0 now implements "two-phase name lookup" correctly. This has the following consequences: - Within a template, you have to use the the typename keyword when a nested type depends on a template parameter. For example, if T is a template parameter, you have to write typename list<T>::iterator, not just list<T>::iterator. Without the typename, the compiler will parse this under the assumption that the name iterator doesn't refer to a type. (See section 14.6 of the C++ standard for more details.)
- Names that do not depend on a template parameter are looked up at the point of template definition, not the point of instantiation. Within a template, for example, f(3) means whatever overload of f best matches an int argument at the point where the template is defined. If there is no appropriate version of f in scope then this is an error, even if such a function is declared later on.
- If a class template inherits from another class template, then base class members won't be found unless they are qualified. (See section 14.6.2, paragraph 3, of the C++ standard.) For example:
- template <typename T> struct Base {
- void f();
- };
- template <typename T> struct Derived : public Base<T> {
- void g() {
- f(); // Error, name not found.
- this->f(); // OK
- Derived::f(); // OK
- Base<T>::f(); // OK
- }
- };
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden