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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 21:16:45 PDT 2020


rsmith added a comment.

Thanks! Is this really the only case we were getting wrong? If so, great!

We should make sure we have test coverage for all the cases affected by P0692R1. Please add some complementary tests for the cases where diagnostics should still be produced. For example, in addition to testing:

  template<typename T, void (TestClass::*)()> class TemplateClass3 {};
  template<typename T> class TemplateClass3<T, &TestClass::func> {};

... please also test ...

  template<typename T> class TemplateClass3<T, &TestClass::func> varTemplate3{};

... which we should diagnose, because that's a primary variable template definition, not a partial / explicit specialization or explicit instantiation.

Please also add testcases for specializations / instantiations of function templates, variable templates, and for explicit specializations of members of class templates:

  template<typename T> struct X {
    struct A {};
    void f();
    enum E : int;
    static int var;
  };
  class Y { using Z = int; };
  template<> struct X<Y::Z>::A {};
  template<> void X<Y::Z>::f() {}
  template<> enum X<Y::Z>::E : int {};
  template<> int X<Y::Z>::var = 76;

(It looks like we incorrectly reject the function and variable cases here, and presumably will still do so after this patch, so there's a little more work to be done before we can call P0692R1 complete.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78404





More information about the cfe-commits mailing list