[clang] [clang][test] Add regression test for invalid 'int decltype {}' (PR #224855)

via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 19 12:53:22 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Demo_mod (Glitch-On)

<details>
<summary>Changes</summary>

The parser crash on `int decltype {}` was fixed by #<!-- -->211221, but the test it added only covers the `= 0` forms. Add the brace-init form reported in the issue.

Fixes #<!-- -->165246

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


1 Files Affected:

- (modified) clang/test/Parser/decltype-crash.cpp (+5) 


``````````diff
diff --git a/clang/test/Parser/decltype-crash.cpp b/clang/test/Parser/decltype-crash.cpp
index af4622df5e54a..8471309665f1d 100644
--- a/clang/test/Parser/decltype-crash.cpp
+++ b/clang/test/Parser/decltype-crash.cpp
@@ -13,3 +13,8 @@ int decltype = 0;
 int *decltype = 0;
 // expected-error at -1 {{expected '(' after 'decltype'}}
 // expected-error at -2 {{expected unqualified-id}}
+
+// GH165246
+int decltype {};
+// expected-error at -1 {{expected '(' after 'decltype'}}
+// expected-error at -2 {{expected unqualified-id}}

``````````

</details>


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


More information about the cfe-commits mailing list