[PATCH] D145034: [Clang][Sema] Preparations to fix handling of out-of-line definitions of constrained templates

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 14:41:40 PST 2023


rsmith added a comment.

This direction looks promising to me.



================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:1677-1678
     CXXScopeSpec Spec;
+    if (TemplateInfo.TemplateParams)
+      Spec.setTemplateParamLists(*TemplateInfo.TemplateParams);
+
----------------
I think we'll need some similar logic for out-of-line definitions of member enums too:
```
template<typename T> struct X;
template<typename T> concept bool Small = sizeof(T) == 1;
template<Small T> struct X<T> {
  enum class E;
};
template<Small T> enum class X<T>::E { e };
```

More generally, anywhere we might pass `EnteringContext = true`, we probably ought to think about whether we have template parameters to pass in.


================
Comment at: clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.spec.mfunc/p1-neg.cpp:2-4
+// XFAIL: *
+// NOTE: This test is marked XFAIL until the diagnostics of
+// too many template parameters is fixed.
----------------
What is the new diagnostic output? (Presumably we no longer match the partial specialization when trying to match the declaration on line 25, because the template parameter list doesn't match.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145034



More information about the cfe-commits mailing list