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

Oleksandr Tarasiuk via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 01:39:26 PDT 2026


https://github.com/a-tarasyuk created https://github.com/llvm/llvm-project/pull/222556

Fixes #115280 

>From ca6cd53cea1cf74503b97f7ec82abddb9b071195 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk <oleksandr.tarasiuk at outlook.com>
Date: Thu, 10 Sep 2026 11:33:28 +0300
Subject: [PATCH] [Clang][NFC] add additional test coverage for default
 argument parsing errors

---
 clang/test/SemaCXX/blocks.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

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'}}
+};
+}



More information about the cfe-commits mailing list