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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.