[clang] [Clang][NFC] add test coverage for parameter declaration errors (PR #222562)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 02:22:46 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 #<!-- -->113465

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


1 Files Affected:

- (modified) clang/test/SemaCXX/enum.cpp (+19) 


``````````diff
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'}}
+}

``````````

</details>


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


More information about the cfe-commits mailing list