[clang] [clang][Sema] Add regression test for GH114174 (PR #233663)
Neil Thomas via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 19 21:01:37 PDT 2026
https://github.com/neilthomass created https://github.com/llvm/llvm-project/pull/233663
PR #143423 fixed the assertion failure reported in #114174, but did not add coverage for the original reproducer
Add a SemaTemplate regression test that verifies the invalid program emits the expected diagnostics without crashing
Fixes #114174
>From de6997261c6d4ceab9dff677c434da59f48b47ff Mon Sep 17 00:00:00 2001
From: Neil Thomas <neilthomas at berkeley.edu>
Date: Mon, 19 Oct 2026 20:49:58 -0700
Subject: [PATCH] [clang][Sema] Add regression test for GH114174
---
clang/test/SemaTemplate/crash-GH114174.cpp | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 clang/test/SemaTemplate/crash-GH114174.cpp
diff --git a/clang/test/SemaTemplate/crash-GH114174.cpp b/clang/test/SemaTemplate/crash-GH114174.cpp
new file mode 100644
index 0000000000000..c421fadb5e352
--- /dev/null
+++ b/clang/test/SemaTemplate/crash-GH114174.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+template <typename T>
+class X {
+public:
+ // expected-error at +1 {{in-class initializer for static data member is not a constant expression}}
+ static const T value = 0 / 0;
+};
+
+// expected-note at +2 {{in instantiation of template class 'X<int>' requested here}}
+// expected-error at +1 {{use of undeclared identifier 'y'}}
+X<int> x = y;
+
+namespace std {
+class type_info {};
+}
+
+template <typename T>
+struct Y {
+ static const int value = sizeof(typeid(T));
+ const int value_1 = value * 1;
+};
More information about the cfe-commits
mailing list