ykhatav wrote:

> template <typename T = int>
> struct Y {                 
>   typedef int outside;     
>   int o;                   
> };                         
>                            
> Y<> y;                     
> Y<>::outside g;

I think the main difference stems from when Clang processes the typedef type. 
In the earlier test case, while processing the members of a struct, we 
encounter the typedef during the creation of the type for the member variable 
"outside." During this typedef creation, the scope is determined based on the 
typedef's context, which is a CXXRecordDecl (while in the RegionMap, we store 
ClassTemplateSpecializationDecl). In the example above, however, the typedef is 
created while emitting the global variable "g," and the context for the typedef 
is a ClassTemplateSpecializationDecl, which can be found in the RegionMap, 
thereby setting the correct scope for the typedef.

https://github.com/llvm/llvm-project/pull/146729
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to