[clang] [Clang][NFC] add additional test coverage for default argument parsing errors (PR #222556)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 01:40:08 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Oleksandr Tarasiuk (a-tarasyuk)

<details>
<summary>Changes</summary>

Fixes #<!-- -->115280 

---
Full diff: https://github.com/llvm/llvm-project/pull/222556.diff


1 Files Affected:

- (modified) clang/test/SemaCXX/blocks.cpp (+10) 


``````````diff
diff --git a/clang/test/SemaCXX/blocks.cpp b/clang/test/SemaCXX/blocks.cpp
index e91751ac43e7e..ff7b6309d6742 100644
--- a/clang/test/SemaCXX/blocks.cpp
+++ b/clang/test/SemaCXX/blocks.cpp
@@ -173,3 +173,13 @@ namespace test8{
 namespace gh189247 {
   template<void (^)()> struct A; // expected-error {{a non-type template parameter cannot have type 'void (^)()'}}
 }
+
+namespace GH115280 {
+struct s {
+  int i = 0;
+  int j = 0;
+  void m(int i = ^{ static int i = 0; return ++i; }(),  // expected-note {{'i' declared here}}
+         int j = ^{ #line 7                             // expected-error {{expected expression}}
+         static int i = 0; return ++i; }()) { }         // expected-error {{reference to local variable 'i' declared in enclosing function 'GH115280::s::m'}}
+};
+}

``````````

</details>


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


More information about the cfe-commits mailing list