[clang] [Clang][NFC] add test coverage for extra semicolons in parameter lists (PR #222572)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 02:54:07 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 #<!-- -->112377

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


1 Files Affected:

- (modified) clang/test/Parser/cxx-extra-semi.cpp (+26-2) 


``````````diff
diff --git a/clang/test/Parser/cxx-extra-semi.cpp b/clang/test/Parser/cxx-extra-semi.cpp
index de14bc0354d80..022f56938798c 100644
--- a/clang/test/Parser/cxx-extra-semi.cpp
+++ b/clang/test/Parser/cxx-extra-semi.cpp
@@ -2,8 +2,8 @@
 // RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify -std=c++11 %s
 // RUN: cp %s %t
-// RUN: %clang_cc1 -x c++ -Wextra-semi -fixit %t
-// RUN: %clang_cc1 -x c++ -Wextra-semi -Werror %t
+// RUN: %clang_cc1 -x c++ -Wextra-semi -fixit -DFIXIT %t
+// RUN: %clang_cc1 -x c++ -Wextra-semi -Werror -DFIXIT %t
 
 class A {
   void A1();
@@ -42,3 +42,27 @@ union B {
 // expected-warning at -6{{extra ';' outside of a function is incompatible with C++98}}
 // expected-warning at -6{{extra ';' outside of a function is incompatible with C++98}}
 #endif
+
+#ifndef FIXIT
+namespace GH112377 {
+struct B { };
+struct Base {
+  Base(struct B;); // expected-error {{unexpected ';' before ')'}} \
+                   // expected-note {{member is declared here}}
+};
+
+class Forward : Base { // expected-note {{constrained by implicitly private inheritance here}} \
+                       // expected-note {{candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type 'B' to 'const Forward' for 1st argument}} \
+                       // expected-note {{candidate constructor (the implicit move constructor) not viable: cannot convert argument of incomplete type 'B' to 'Forward' for 1st argument}} \
+                       // expected-note {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
+  using Base::Base;
+};
+
+class A : Forward {
+  A();
+};
+
+A::A() : Forward(B()) { } // expected-error {{'B' is a private member of 'GH112377::Base'}} \
+                          // expected-error {{no matching constructor for initialization of 'Forward'}}
+}
+#endif

``````````

</details>


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


More information about the cfe-commits mailing list