Krystian S
Krystian S

Reputation: 1616

Are unqualified names of non-static data members with dependent types dependent

Dependent names are not clearly defined in the C++ standard, so it leaves a lot to be desired in terms of determining what a dependent name is, which leads me to this question: Are unqualified names of non-static data members with dependent types dependent? For example:

template<typename T>
struct S { T t; };

Is the name t here a dependent name? The type certainly is dependent, but it's not clear if the name is, since it can always be resolved to refer to a member.

Upvotes: 1

Views: 77

Answers (1)

Davis Herring
Davis Herring

Reputation: 39818

No, t is not dependent. While there is an open issue about expanding the definition of a dependent name, the idea of a name being dependent is that lookup for it is deferred. (Even without ADL, consider the lookup for T::foo, which might be a function, a function template, or a data member (without template or typename).) That’s not the case here; t (in a context inside S) is immediately resolved to the class member.

Upvotes: 2

Related Questions