[clang] [NFC][clang] Avoid inheriting [[noreturn]] in explicit function template specializations (PR #150003)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 22 07:06:59 PDT 2025


================
@@ -44,3 +44,18 @@ void testTemplates() {
   throwErrorTemplate("ERROR");
   (void)ensureZeroTemplate(42);
 }
+
+// Ensure that explicit specialization of a member function does not inherit
+// the warning from the primary template.
+
+template<typename T>
+struct S {
+  void f();
+};
+
+template<typename T>
+void S<T>::f() { throw 0; } 
+template<>
+void S<int>::f() {} // expected-no-diagnostics
----------------
zwuis wrote:

Duplicate `// expected-no-diagnostics`?


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


More information about the cfe-commits mailing list