[clang] [Clang][NFC] Add regression tests for a couple resolved issues (PR #222944)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 06:24:32 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Corentin Jabot (cor3ntin)

<details>
<summary>Changes</summary>

Fixes #<!-- -->38721 (Clang 18)
Fixes #<!-- -->58682 (Clang 18)

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


1 Files Affected:

- (modified) clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp (+21) 


``````````diff
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
index 9c25e26f43c36..2ab39ee9e13bf 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
@@ -626,3 +626,24 @@ namespace GH118190 {
   template <auto> int x;
   template <int i> int x<i>;
 }
+
+namespace GH38721 {
+  template <bool, decltype(auto)> struct A { static constexpr int k = 0; };
+  template <decltype(auto) v> struct A<true, v> { static constexpr int k = 1; };
+
+  const double d = 10.0;
+  static_assert(A<true, 1>::k == 1, "");
+  static_assert(A<true, (d)>::k == 1, "");
+} // namespace GH38721
+
+namespace GH58682 {
+  template <decltype(auto) v> struct A {};
+  template <decltype(auto) v> constexpr decltype(v) get(A<v>) { return v; }
+
+  int g;
+  static_assert(&get(A<(g)>{}) == &g, "");
+
+  template <typename> struct B;
+  template <decltype(auto) v> struct B<A<v>> { static constexpr int k = 1; };
+  static_assert(B<A<(g)>>::k == 1, "");
+} // namespace GH58682

``````````

</details>


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


More information about the cfe-commits mailing list