[clang] [clang] Implement CWG2611 (PR #133747)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 9 10:45:28 PDT 2025
================
@@ -35,6 +35,29 @@ namespace std {
template<typename T> T declval();
} // namespace std
+namespace cwg2611 { // cwg2611: 21
+#if __cplusplus >= 201703L
+template<class> class R {};
+template<class... Ts> auto a(Ts... xs) -> R<decltype((xs + ...))>;
+template<class... Ts> auto b(Ts... xs) -> R<decltype((..., xs))>;
+template<class... Ts> auto c(Ts... xs, int i = 0) -> R<decltype((xs * ... * i))>;
+template<class... Ts> auto d(Ts... xs, int i = 0) -> R<decltype((i ^ ... ^ xs))>;
+R<int&> i = a(1);
+R<int&> j = b(1);
+R<int&> k = c();
+R<int&> l = d();
+
----------------
offsetof wrote:
These testcases are checking the same thing as the one in the issue (if I understand correctly what you're referring to). Could you clarify what you think is missing?
https://github.com/llvm/llvm-project/pull/133747
More information about the cfe-commits
mailing list