[clang] [Clang] Ensure the method scope at the late parsing of noexcept specifiers (PR #98023)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 8 22:01:02 PDT 2024


================
@@ -113,8 +113,9 @@ namespace Static {
     static auto g() -> decltype(this->m); // expected-error{{'this' cannot be used in a static member function declaration}}
 
     static int h();
-    
-    static int i() noexcept(noexcept(m + 2)); // expected-error{{'this' cannot be implicitly used in a static member function declaration}}
+
+    // The use of 'm' doesn't constitute an ODR use, so we don't have a reason to reject it.
+    static int i() noexcept(noexcept(m + 2));
----------------
zyn0217 wrote:

Done. I didn't even know we had relevant wordings about such scenarios until @frederick-vs-ja (thanks!) told me about [[expr.prim.id.general](https://eel.is/c++draft/expr.prim#id.general-4.3)]/4.

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


More information about the cfe-commits mailing list