[clang] [Clang][Sema] Reject declaring an alias template with the same name as its template parameter. (PR #123533)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 24 13:42:42 PST 2025


================
@@ -65,7 +65,8 @@ namespace InFunctions {
   template<typename...T> struct S3 { // expected-note {{template parameter is declared here}}
     template<typename Z> using T = int; // expected-error {{declaration of 'T' shadows template parameter}}
   };
-  template<typename Z> using Z = Z;
+  template<typename Z> // expected-note {{template parameter is declared here}}
+  using Z = Z; // expected-error {{declaration of 'Z' shadows template parameter}}
----------------
zygoloid wrote:

That namespace name is weird -- there are no functions in it at all. There doesn't even seem to be any common theme for these tests. It'd be nice to split this namespace up into distinct namespaces for the different things being tested -- maybe `UnexpandedPack` for `S0`, `InvalidType` for `T1` and `T2`, and `ShadowTemplateParam` for `S3` and `Z`.

https://github.com/llvm/llvm-project/pull/123533


More information about the cfe-commits mailing list