[clang] [Clang][NFC] add test coverage for extra semicolons in parameter lists (PR #222572)
Oleksandr Tarasiuk via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 02:53:31 PDT 2026
https://github.com/a-tarasyuk created https://github.com/llvm/llvm-project/pull/222572
Fixes #112377
>From c5dcf79e2bbe15db64d5d846bf8e672cb6303f65 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk <oleksandr.tarasiuk at outlook.com>
Date: Thu, 10 Sep 2026 12:52:38 +0300
Subject: [PATCH] [Clang][NFC] add test coverage for extra semicolons in
parameter lists
---
clang/test/Parser/cxx-extra-semi.cpp | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
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
More information about the cfe-commits
mailing list