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

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


https://github.com/Glitch-On updated https://github.com/llvm/llvm-project/pull/224855

>From a861f94320fb8f43e9f57339a112a94325afa2cc Mon Sep 17 00:00:00 2001
From: Vansh <gaurvansh133 at gmail.com>
Date: Sun, 20 Sep 2026 01:09:23 +0530
Subject: [PATCH] [clang][test] Add regression test for invalid 'int decltype
 {}'

The parser crash on this input was fixed by #211221, which only added
tests for the '= 0' forms. Add the brace-init form reported in the
issue.

Fixes #165246
---
 clang/test/Parser/decltype-crash.cpp | 5 +++++
 1 file changed, 5 insertions(+)

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}}



More information about the cfe-commits mailing list