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

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 13 19:08:04 PDT 2026


Author: Oleksandr Tarasiuk
Date: 2026-09-14T05:07:59+03:00
New Revision: 9e70d8f070ba046b8e09388fa84b3a65eb2073e3

URL: https://github.com/llvm/llvm-project/commit/9e70d8f070ba046b8e09388fa84b3a65eb2073e3
DIFF: https://github.com/llvm/llvm-project/commit/9e70d8f070ba046b8e09388fa84b3a65eb2073e3.diff

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

Fixes #115280

Added: 
    

Modified: 
    clang/test/SemaCXX/blocks.cpp

Removed: 
    


################################################################################
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