[PATCH] D145034: [Clang][Sema] Preparations to fix handling of out-of-line definitions of constrained templates
Alexander Shaposhnikov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 3 00:25:54 PST 2023
alexander-shaposhnikov added inline comments.
================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:1677-1678
CXXScopeSpec Spec;
+ if (TemplateInfo.TemplateParams)
+ Spec.setTemplateParamLists(*TemplateInfo.TemplateParams);
+
----------------
rsmith wrote:
> 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.
Added missing bits for enums,
regarding EnteringContext = true - yeah, I agree, I haven't done it on this diff cause I'm kind of worried to do it without test cases and extracting test cases requires some efforts.
================
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.
----------------
rsmith wrote:
> 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.)
the new diagnostic output:
error: nested name specifier 'A<T *, 2>::' for declaration does not refer into a class, class template or class template partial specialization
```
template<typename T, int N>
void A<T*, 2>::f0() { }
```
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