C++ Logo

STD-DISCUSSION

Advanced search

Subject: Is the local class of function template be considered as dependent type
From: jim x (xmh970252187_at_[hidden])
Date: 2020-08-20 22:35:52


Hi, everyone. please consider the below code:

````
template<typename T>
void func(){
struct Test{};
show(Test{});
}
void show(...){
}
int main(){
func<int>();
}
````
There is no any rule in [temp.dep.type] to specify the local class
declared within function template may be considered as dependent type.
So, I think the name lookup for `show` should be bound at the point it
is used. The second phase name lookup shouldn't occur due to `show` is
not a dependent-name, at least according to the definition of
dependent-name in section [temp.dep]. However, current implementations
all consider `show` as a dependent-name which will be found by ADL in
the context of instantiation, that is, The local class `Test` is
viewed as dependent-type. If I don't misunderstand the section
[temp.dep.type], how would `Test` be a dependent-type? For such a
local class, Is it a case missed in the section [temp.dep.type].
Thanks for discussing such an example.


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups