[clang] 388490c - [clang][Sema] Add regression test for GH114174 (#233663)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 20:20:37 PST 2026
Author: Neil Thomas
Date: 2026-11-27T12:20:31+08:00
New Revision: 388490caac74f4b344aac05de7455a5a8e574ae9
URL: https://github.com/llvm/llvm-project/commit/388490caac74f4b344aac05de7455a5a8e574ae9
DIFF: https://github.com/llvm/llvm-project/commit/388490caac74f4b344aac05de7455a5a8e574ae9.diff
LOG: [clang][Sema] Add regression test for GH114174 (#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
Added:
clang/test/SemaTemplate/crash-GH114174.cpp
Modified:
Removed:
################################################################################
diff --git a/clang/test/SemaTemplate/crash-GH114174.cpp b/clang/test/SemaTemplate/crash-GH114174.cpp
new file mode 100644
index 0000000000000..02d3d49aac397
--- /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 {{division by zero}}
+};
+
+// 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