[clang] 61f36e3 - [clang] Add regression test for #145012 (#242008)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 14 05:16:43 PST 2026
Author: Ivan Lok
Date: 2026-11-14T21:16:38+08:00
New Revision: 61f36e3a3c573e3559149f4f3dc9d2f125fc8d8e
URL: https://github.com/llvm/llvm-project/commit/61f36e3a3c573e3559149f4f3dc9d2f125fc8d8e
DIFF: https://github.com/llvm/llvm-project/commit/61f36e3a3c573e3559149f4f3dc9d2f125fc8d8e.diff
LOG: [clang] Add regression test for #145012 (#242008)
Add a test for a generic lambda with an explicit template parameter list
inside a function template that takes a pointer non-type template
parameter. Clang 21 rejects it with "conversion from 'int *' to 'void *'
is not allowed in a converted constant expression".
This was fixed by 078e99e (#161029), but no test covered this case.
Closes #145012
Added:
Modified:
clang/test/SemaTemplate/temp_arg_nontype_cxx2c.cpp
Removed:
################################################################################
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx2c.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx2c.cpp
index c4ac36e263bc85..b7a486b2c0ff0a 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx2c.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx2c.cpp
@@ -134,3 +134,17 @@ namespace error_on_type_instantiation {
template void g<int>();
// expected-note at -1 {{in instantiation of function template specialization}}
}
+
+namespace GH145012 {
+ int x;
+
+ template<void* p>
+ void f() {
+ []<typename = void>() {
+ static_assert(p == &x);
+ }();
+ }
+
+ template void f<(void*)&x>();
+
+} // namespace GH145012
More information about the cfe-commits
mailing list