[PATCH] D92024: [clang] Implement P0692R1 from C++20 (access checking on specializations and instantiations)

Kristina Bessonova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 8 14:09:03 PDT 2021


krisb added a comment.

Do we still need the following tests:

- clang/test/CXX/temp/temp.spec/temp.explicit/p11.cpp
- clang/test/CXX/temp/temp.spec/temp.explicit/p12.cpp

?



================
Comment at: clang/test/CXX/temp/temp.spec/func.spec.cpp:105
+template <typename T> void func10(A::B<T>, int x) {}
+template <typename T> void func11(A::C, A::D<T>, int) {}
+template <typename T> void func12() {}
----------------
aorlov wrote:
> krisb wrote:
> > Before this patch clang diagnosed cases like 
> > 
> > ```
> > class A { class C {}; };
> > template <typename T> void func(A::C) {}
> > ```
> > Why is it no longer the case?
> > 
> Your example generates an error `error: 'C' is a private member of 'A'` on latest clang.
> This patch is intended to implement a proposal [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0692r1.html | p0692r1]] and consider this example as valid.
> Did I understand your question correctly?
It doesn't seem the aforementioned example falls under any of the cases from P0692R1 unless I misinterpreted its wordings.
It's a primary template, right?
Consider also the following example for which clang issues the error in both cases (before and after the patch):
```
class A { class C {}; };
template <class T> A::C func();
```
I'm also wondering about something like:
```
class A { class C {}; };
template <typename T> T func() {}
template <> A::C func<A::C>();
```


================
Comment at: clang/test/CXX/temp/temp.spec/part.spec.cpp:3
+
+// C++20 [temp.class.spec] 17.6.5/10:
+//   The usual access checking rules do not apply to non-dependent names used
----------------
It seems this test checks more than just partial specialization cases.
Could you please align the comments with what the test actually tests?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92024/new/

https://reviews.llvm.org/D92024



More information about the cfe-commits mailing list