[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
Wed Apr 28 03:07:14 PDT 2021


krisb added a comment.

Thank you! It looks more consistent now.



================
Comment at: clang/lib/Parse/ParseDecl.cpp:3080
+    // For instance this marked as unavailable:
+    //    class __attribute((unavailable)) UnavailableClass;`
+    auto RemoveAccessCheckingDiagnostics = [&TemplateInfo, this]() {
----------------
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.


================
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>() {
+  }
----------------
Formatting seems broken here and below.


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