rsmith added inline comments.

================
Comment at: lib/AST/DeclCXX.cpp:1349-1354
+      while (!CTD->isMemberSpecialization()) {
+        auto *NewCTD = CTD->getInstantiatedFromMemberTemplate();
+        if (!NewCTD)
           break;
         CTD = NewCTD;
       }
----------------
loladiro wrote:
> rsmith wrote:
> > The same bug exists in `VarDecl::getTemplateInstantiationPattern`; can you 
> > fix it there too?
> Do you have a test case that shows a problem with the current definition of 
> that function? Would like to include it if possible. I tried cooking one up, 
> but wasn't particularly successful.
Since this is only currently used by the modules visibility code, you'd 
presumably need something like this:
```
  // submodule a.x
  template<typename T> struct A {
    template<typename U> static const int n;
  };
```
```
  // submodule a.y
  import a.x
  template<typename T> template<typename U> const int A<T>::n = 1;
```
```
  // submodule a.z
  import a.x
  template<> template<typename U> const int A<int>::n = 2;
```
```
  // test
  import a.z
  // I expect this to fail because we would incorrectly check to see whether 
the definition from a.y is visible, because we never check whether the 
definition from a.z is a member specialization.
  static_assert(A<int>::n<int> == 2);


Repository:
  rL LLVM

https://reviews.llvm.org/D13419



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to