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

Alex Orlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 10:17:38 PDT 2021


aorlov added a comment.

@krisb
Thanks for the review.



================
Comment at: clang/lib/Parse/ParseDecl.cpp:3080
+    // For instance this marked as unavailable:
+    //    class __attribute((unavailable)) UnavailableClass;`
+    auto RemoveAccessCheckingDiagnostics = [&TemplateInfo, this]() {
----------------
krisb wrote:
> Basically, if `__attribute((unavailable))` should trigger the error for any use of an unavailable class, we have it already broken.
> For example, for this code clang-12 doesn't produce any diagnostics:
> ```
> class __attribute((unavailable)) X {
>   template <typename T> class __attribute((unavailable)) Y {};
> };
> class __attribute((unavailable)) A { 
>     class __attribute((unavailable)) C {}; 
> };
> template <> class X::Y<A::C> {};
> ```
> So, I don't see much sense in inventing something new to workaround only the cases that come with this patch. It's better to either fix it globally or leave it broken atm with the corresponding FIXME.
Anyway, I tried to remove the access diagnostics only. Who knows which diagnostics may be needed. Or you strongly prefer using `SuppressAccessChecks` instead?


================
Comment at: clang/test/CXX/temp/temp.spec/func.spec.cpp:54
+  template <> void func2<class A::D<char>>() {
+  } template <> void func3<class A::C>() {
+  }
----------------
krisb wrote:
> Formatting seems broken here and below.
This is clang-format fault. I wrote it at different lines. Just has to add a line between.


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