[clang] [Clang][NFC] add test coverage for parameter declaration errors (PR #222562)
Oleksandr Tarasiuk via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 02:22:05 PDT 2026
https://github.com/a-tarasyuk created https://github.com/llvm/llvm-project/pull/222562
Fixes #113465
>From 72291414e419d6a5d9b15e91a8fb481f523653b3 Mon Sep 17 00:00:00 2001
From: Oleksandr Tarasiuk <oleksandr.tarasiuk at outlook.com>
Date: Thu, 10 Sep 2026 12:20:58 +0300
Subject: [PATCH] [Clang][NFC] add test coverage for parameter declaration
errors
---
clang/test/SemaCXX/enum.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/clang/test/SemaCXX/enum.cpp b/clang/test/SemaCXX/enum.cpp
index 44042d8bf5cfc..e13e45db0a937 100644
--- a/clang/test/SemaCXX/enum.cpp
+++ b/clang/test/SemaCXX/enum.cpp
@@ -151,3 +151,22 @@ class C {
// expected-error {{unexpected ';' before ')'}}
};
}
+
+namespace GH113465 {
+struct A { };
+
+enum E : int { A = 1, }; // expected-note {{struct 'A' is hidden by a non-type declaration of 'A' here}}
+#if __cplusplus < 201103L
+// expected-warning at -2 {{enumeration types with a fixed underlying type are a C++11 extension}}
+// expected-warning at -3 {{commas at the end of enumerator lists are a C++11 extension}}
+#endif
+
+struct B { // expected-note {{B defined here}}
+ void f(A // expected-error {{must use 'struct' tag to refer to type 'A' in this scope}} \
+ // expected-error {{expected ';' after struct}} \
+ // expected-note {{to match this '('}}
+#pragma message "Any Message"*); // expected-error {{pragma message requires parenthesized string}}
+}; // expected-error {{expected ')'}}
+
+void B::f(A *p) { } // expected-error {{out-of-line definition of 'f' does not match any declaration in 'GH113465::B'}}
+}
More information about the cfe-commits
mailing list