[clang] [clang] Avoid assertion on invalid member template specialization (PR #201506)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 12 02:01:46 PDT 2026
================
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// regression test for https://github.com/llvm/llvm-project/issues/201490
+template<class T> struct A {};
+template<class T> struct B : A<T> {};
+template<> template<class T> class A<int>::B {}; // expected-error{{out-of-line definition of 'B' does not match any declaration in 'A<int>'}}
+
+// A legitimate member class template explicit specialization
+template<class T> struct C { template<class U> struct D; };
+ template<> template<class U> struct C<int>::D {};
----------------
zyn0217 wrote:
Also simply testing the invalid case is enough, I'd remove the 'legitimate' one.
https://github.com/llvm/llvm-project/pull/201506
More information about the cfe-commits
mailing list