[clang] [clang] Add tests for some of CWG issues resolved in Croydon (2026-03) (PR #189299)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Sat May 9 00:59:15 PDT 2026
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/189299
>From c185a2bc57aa640ed1b4530574f368c076cc19a9 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Mon, 30 Mar 2026 04:50:27 +0300
Subject: [PATCH 1/5] [clang] Add tests for some of CWG issues resolved in
Croydon (2026-03) as P4160R0
---
clang/test/CXX/drs/cwg26xx.cpp | 2 +
clang/test/CXX/drs/cwg27xx.cpp | 67 ++++++++++++++++++++++++++++++----
clang/test/CXX/drs/cwg29xx.cpp | 10 +++++
clang/test/CXX/drs/cwg30xx.cpp | 11 ++++++
clang/test/CXX/drs/cwg31xx.cpp | 40 ++++++++++++++++++++
5 files changed, 123 insertions(+), 7 deletions(-)
create mode 100644 clang/test/CXX/drs/cwg31xx.cpp
diff --git a/clang/test/CXX/drs/cwg26xx.cpp b/clang/test/CXX/drs/cwg26xx.cpp
index 5fe409a3b2905..7f99cd684e08e 100644
--- a/clang/test/CXX/drs/cwg26xx.cpp
+++ b/clang/test/CXX/drs/cwg26xx.cpp
@@ -267,6 +267,8 @@ void f() {
}
} // namespace cwg2654
+// cwg2660: na
+
namespace cwg2681 { // cwg2681: 17
#if __cplusplus >= 202002L
using size_t = decltype(sizeof(int));
diff --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp
index ae5874ce3c46d..1d615ffa5a303 100644
--- a/clang/test/CXX/drs/cwg27xx.cpp
+++ b/clang/test/CXX/drs/cwg27xx.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++98 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx98 %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++14 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx20 %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx20,since-cxx23 %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++98 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx11
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++14 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx11,since-cxx14
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx11,since-cxx14
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx11,since-cxx14,since-cxx20
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx11,since-cxx14,since-cxx20,since-cxx23
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx11,since-cxx14,since-cxx20,since-cxx23,since-cxx26
#if __cplusplus == 199711L
#define static_assert(...) __extension__ _Static_assert(__VA_ARGS__)
@@ -18,6 +18,25 @@
#endif
namespace std {
+#if __cplusplus >= 201103L
+using size_t = decltype(sizeof(0));
+template <typename T>
+struct initializer_list {
+ const T *p;
+ size_t n;
+
+ #if __cplusplus >= 201402L
+ constexpr
+ #endif
+ initializer_list(const T *p, size_t n);
+
+ #if __cplusplus >= 201402L
+ constexpr
+ #endif
+ const T* begin() const { return {}; };
+};
+#endif
+
#if __cplusplus >= 202002L
struct strong_ordering {
int n;
@@ -174,6 +193,40 @@ static_assert(!__is_layout_compatible(StructWithAnonUnion, StructWithAnonUnion3)
#endif
} // namespace cwg2759
+namespace cwg2765 { // cwg2765: partial
+static_assert(+"foo" == "foo", "");
+// expected-error at -1 {{static assertion expression is not an integral constant expression}}
+// expected-note at -2 {{comparison of addresses of potentially overlapping literals has unspecified value}}
+static_assert("xfoo" + 1 == "foo\0y", "");
+// expected-warning at -1 {{adding 'int' to a string does not append to the string}}
+// expected-note at -2 {{use array indexing to silence this warning}}
+// expected-error at -3 {{static assertion expression is not an integral constant expression}}
+// expected-note at -4 {{comparison of addresses of potentially overlapping literals has unspecified value}}
+static_assert("foo" + 0 != "bar", "");
+// expected-warning at -1 {{adding 'int' to a string does not append to the string}}
+// expected-note at -2 {{use array indexing to silence this warning}}
+// cxx98-error at -3 {{static assertion expression is not an integral constant expression}} FIXME
+static_assert((const char*)"foo" != "oo", "");
+// cxx98-error at -1 {{static assertion expression is not an integral constant expression}} FIXME
+
+#if __cplusplus >= 201103L
+constexpr const char *f() { return "foo"; }
+constexpr bool b2 = f() == f();
+// since-cxx11-error at -1 {{constexpr variable 'b2' must be initialized by a constant expression}}
+// since-cxx11-note at -2 {{comparison of addresses of potentially overlapping literals has unspecified value}}
+constexpr const char *p = f();
+constexpr bool b3 = p == p;
+#endif
+
+#if __cplusplus >= 201402L
+constexpr std::initializer_list<int *> il1 = { (int *)nullptr };
+constexpr std::initializer_list<unsigned long> il2 = { 0 };
+constexpr bool b7 = il1.begin() == (void *)il2.begin();
+// FIXME-error at -1 {{constexpr variable 'b2' must be initialized by a constant expression}}
+// FIXME-note at -2 {{address of a constexpr-unknown object cannot be used for comparison}}
+#endif
+} // namespace cwg2765
+
namespace cwg2770 { // cwg2770: 20 open 2023-07-14
#if __cplusplus >= 202002L
template<typename T>
diff --git a/clang/test/CXX/drs/cwg29xx.cpp b/clang/test/CXX/drs/cwg29xx.cpp
index 54f5547a1629d..165c2943b6b4a 100644
--- a/clang/test/CXX/drs/cwg29xx.cpp
+++ b/clang/test/CXX/drs/cwg29xx.cpp
@@ -175,3 +175,13 @@ constexpr U _ = nondeterministic(true);
} // namespace cwg2922
// cwg2947 is in cwg2947.cpp
+
+namespace cwg2966 { // cwg2966: 2.7
+#if __cplusplus >= 201103L
+static_assert(sizeof(decltype(nullptr)) == sizeof(void*), "");
+static_assert(alignof(decltype(nullptr)) == alignof(void*), "");
+#endif
+} // namespace cwg2966
+
+// cwg2983: na
+// cwg2992: na
diff --git a/clang/test/CXX/drs/cwg30xx.cpp b/clang/test/CXX/drs/cwg30xx.cpp
index 356c2cd68b4b7..a625acfb6f585 100644
--- a/clang/test/CXX/drs/cwg30xx.cpp
+++ b/clang/test/CXX/drs/cwg30xx.cpp
@@ -21,3 +21,14 @@ void f(
}
} // namespace cwg3005
+
+namespace cwg3035 { // cwg3035: no
+#if __cplusplus >= 201103L
+static union {
+ int x = [] { return 42; }();
+ // FIXME-error at -1 {{lambda expressions are not allowed in anonymous unions}}
+};
+#endif
+} // namespace cwg3035
+
+// cwg3058: na
diff --git a/clang/test/CXX/drs/cwg31xx.cpp b/clang/test/CXX/drs/cwg31xx.cpp
new file mode 100644
index 0000000000000..803ace4d06202
--- /dev/null
+++ b/clang/test/CXX/drs/cwg31xx.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -std=c++98 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-11
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-11
+// RUN: %clang_cc1 -std=c++14 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
+// RUN: %clang_cc1 -std=c++17 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
+// RUN: %clang_cc1 -std=c++20 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
+// RUN: %clang_cc1 -std=c++23 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
+// RUN: %clang_cc1 -std=c++2c -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
+
+// cxx98-11-no-diagnostics
+
+namespace cwg3128 { // cwg3128: 2.7
+#if __cplusplus >= 201103L
+void f();
+static_assert(noexcept(noexcept(f())), "");
+#endif
+} // namespace cwg3128
+
+namespace cwg3151 { // cwg3151: 2.7
+#if __cplusplus >= 201402L
+auto lambda = []{};
+struct S : decltype(lambda) {};
+#endif
+} // namespace cwg3151
+
+namespace cwg3156 { // cwg3156: 3.5
+#if __cplusplus >= 201402L
+struct C { // #cwg3156-C
+ C(int) = delete; // #cwg3156-C-int
+ C(){};
+};
+
+int x = [b = C(3)](){ return 4; }();
+// since-cxx14-error at -1 {{functional-style cast from 'int' to 'C' uses deleted function}}
+// since-cxx14-note@#cwg3156-C-int {{candidate constructor has been explicitly deleted}}
+// since-cxx14-note@#cwg3156-C {{candidate constructor (the implicit copy constructor)}}
+// since-cxx14-note@#cwg3156-C {{candidate constructor (the implicit move constructor)}}
+#endif
+} // namespace cwg3156
+
+// cwg3172: na
>From aa7488dde16e1e8a5ac45df47bb110a1d2a29c4c Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Mon, 4 May 2026 11:26:12 +0300
Subject: [PATCH 2/5] Update cxx_dr_status.html
---
clang/www/cxx_dr_status.html | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index cc290eabd943b..bde9527fc4d67 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -18425,7 +18425,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/expr.call">expr.call</a>]</td>
<td>DR</td>
<td>Confusing term "this parameter"</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="na" align="center">N/A</td>
</tr>
<tr id="2661">
<td><a href="https://cplusplus.github.io/CWG/issues/2661.html">2661</a></td>
@@ -19160,7 +19160,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/intro.object">intro.object</a>]</td>
<td>DR</td>
<td>Address comparisons between potentially non-unique objects during constant evaluation</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="partial" align="center">Partial</td>
</tr>
<tr class="open" id="2766">
<td><a href="https://cplusplus.github.io/CWG/issues/2766.html">2766</a></td>
@@ -20579,7 +20579,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/basic.fundamental">basic.fundamental</a>]</td>
<td>DR</td>
<td>Alignment and value representation of <TT>std::nullptr_t</TT></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 2.7</td>
</tr>
<tr class="open" id="2967">
<td><a href="https://cplusplus.github.io/CWG/issues/2967.html">2967</a></td>
@@ -20698,7 +20698,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/basic.pre">basic.pre</a>]</td>
<td>DR</td>
<td>Non-type template parameters are not variables</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="na" align="center">N/A</td>
</tr>
<tr class="open" id="2984">
<td><a href="https://cplusplus.github.io/CWG/issues/2984.html">2984</a></td>
@@ -20761,7 +20761,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/basic.pre">basic.pre</a>]</td>
<td>DR</td>
<td>Labels do not have names</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="na" align="center">N/A</td>
</tr>
<tr class="open" id="2993">
<td><a href="https://cplusplus.github.io/CWG/issues/2993.html">2993</a></td>
@@ -21062,7 +21062,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/class.union.anon">class.union.anon</a>]</td>
<td>DR</td>
<td>Lambda expressions in anonymous unions</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="none" align="center">No</td>
</tr>
<tr class="open" id="3036">
<td><a href="https://cplusplus.github.io/CWG/issues/3036.html">3036</a></td>
@@ -21223,7 +21223,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/basic.lookup.general">basic.lookup.general</a>]</td>
<td>DR</td>
<td>"Program point" is not defined</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="na" align="center">N/A</td>
</tr>
<tr id="3059">
<td><a href="https://cplusplus.github.io/CWG/issues/3059.html">3059</a></td>
@@ -21713,7 +21713,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/except.spec">except.spec</a>]</td>
<td>DR</td>
<td>Potentially-throwing unevaluated operands</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 2.7</td>
</tr>
<tr id="3129">
<td><a href="https://cplusplus.github.io/CWG/issues/3129.html">3129</a></td>
@@ -21874,7 +21874,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/expr.prim.lambda.closure">expr.prim.lambda.closure</a>]</td>
<td>DR</td>
<td>Closure types that are <TT>final</TT></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 2.7</td>
</tr>
<tr id="3152">
<td><a href="https://cplusplus.github.io/CWG/issues/3152.html">3152</a></td>
@@ -21909,7 +21909,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/expr.prim.lambda.capture">expr.prim.lambda.capture</a>]</td>
<td>DR</td>
<td>Handling of deleted functions in unevaluated <I>lambda-capture</I>s</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 3.5</td>
</tr>
<tr id="3157">
<td><a href="https://cplusplus.github.io/CWG/issues/3157.html">3157</a></td>
@@ -22021,7 +22021,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>[<a href="https://wg21.link/temp.constr.normal">temp.constr.normal</a>]</td>
<td>accepted</td>
<td>Reference to wrong placeholder</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="na" align="center">N/A</td>
</tr>
<tr id="3173">
<td><a href="https://cplusplus.github.io/CWG/issues/3173.html">3173</a></td>
>From 5830f8812fe973abd143b0e224cb44853c573680 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Mon, 4 May 2026 11:44:13 +0300
Subject: [PATCH 3/5] Add `__is_final` test case for CWG3151
---
clang/test/CXX/drs/cwg31xx.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang/test/CXX/drs/cwg31xx.cpp b/clang/test/CXX/drs/cwg31xx.cpp
index dd75247681b16..b4abb912d05f9 100644
--- a/clang/test/CXX/drs/cwg31xx.cpp
+++ b/clang/test/CXX/drs/cwg31xx.cpp
@@ -25,6 +25,7 @@ namespace cwg3151 { // cwg3151: 2.7
#if __cplusplus >= 201402L
auto lambda = []{};
struct S : decltype(lambda) {};
+static_assert(!__is_final(decltype(lambda)), "");
#endif
} // namespace cwg3151
>From e4f38e264b3648bba96c7b7daf6a21ab1879bd6a Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Mon, 4 May 2026 13:42:52 +0300
Subject: [PATCH 4/5] Address review feedback
---
clang/test/CXX/drs/cwg27xx.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp
index 3eb4742f8f70d..04bdf4f7251fe 100644
--- a/clang/test/CXX/drs/cwg27xx.cpp
+++ b/clang/test/CXX/drs/cwg27xx.cpp
@@ -33,7 +33,7 @@ struct initializer_list {
#if __cplusplus >= 201402L
constexpr
#endif
- const T* begin() const { return {}; };
+ const T* begin() const { return p; };
};
#endif
@@ -222,7 +222,7 @@ constexpr bool b3 = p == p;
constexpr std::initializer_list<int *> il1 = { (int *)nullptr };
constexpr std::initializer_list<unsigned long> il2 = { 0 };
constexpr bool b7 = il1.begin() == (void *)il2.begin();
-// FIXME-error at -1 {{constexpr variable 'b2' must be initialized by a constant expression}}
+// FIXME-error at -1 {{constexpr variable 'b7' must be initialized by a constant expression}}
// FIXME-note at -2 {{address of a constexpr-unknown object cannot be used for comparison}}
#endif
} // namespace cwg2765
>From 1502e5316f1f36f69ac9551dff7a13acfe66a22a Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sat, 9 May 2026 10:58:58 +0300
Subject: [PATCH 5/5] Addres review feedback
---
clang/test/CXX/drs/cwg31xx.cpp | 28 +++++++++++------------
clang/test/SemaCXX/lambda-expressions.cpp | 7 ++++++
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/clang/test/CXX/drs/cwg31xx.cpp b/clang/test/CXX/drs/cwg31xx.cpp
index b4abb912d05f9..53123d25b3a80 100644
--- a/clang/test/CXX/drs/cwg31xx.cpp
+++ b/clang/test/CXX/drs/cwg31xx.cpp
@@ -1,12 +1,12 @@
-// RUN: %clang_cc1 -std=c++98 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-11
-// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-11
-// RUN: %clang_cc1 -std=c++14 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
-// RUN: %clang_cc1 -std=c++17 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
-// RUN: %clang_cc1 -std=c++20 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
-// RUN: %clang_cc1 -std=c++23 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
-// RUN: %clang_cc1 -std=c++2c -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx14
+// RUN: %clang_cc1 -std=c++98 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-17
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-17
+// RUN: %clang_cc1 -std=c++14 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-17
+// RUN: %clang_cc1 -std=c++17 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,cxx98-17
+// RUN: %clang_cc1 -std=c++20 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx20
+// RUN: %clang_cc1 -std=c++23 -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx20
+// RUN: %clang_cc1 -std=c++2c -fexceptions -fcxx-exceptions -pedantic-errors %s -verify-directives -verify=expected,since-cxx20
-// cxx98-11-no-diagnostics
+// cxx98-17-no-diagnostics
namespace cwg3106 { // cwg3106: 2.7
#if __cplusplus >= 201103L
@@ -30,17 +30,17 @@ static_assert(!__is_final(decltype(lambda)), "");
} // namespace cwg3151
namespace cwg3156 { // cwg3156: 3.5
-#if __cplusplus >= 201402L
+#if __cplusplus >= 202002L
struct C { // #cwg3156-C
C(int) = delete; // #cwg3156-C-int
C(){};
};
-int x = [b = C(3)](){ return 4; }();
-// since-cxx14-error at -1 {{functional-style cast from 'int' to 'C' uses deleted function}}
-// since-cxx14-note@#cwg3156-C-int {{candidate constructor has been explicitly deleted}}
-// since-cxx14-note@#cwg3156-C {{candidate constructor (the implicit copy constructor)}}
-// since-cxx14-note@#cwg3156-C {{candidate constructor (the implicit move constructor)}}
+decltype([b = C(3)](){ return 4; }()) x;
+// since-cxx20-error at -1 {{functional-style cast from 'int' to 'C' uses deleted function}}
+// since-cxx20-note@#cwg3156-C-int {{candidate constructor has been explicitly deleted}}
+// since-cxx20-note@#cwg3156-C {{candidate constructor (the implicit copy constructor)}}
+// since-cxx20-note@#cwg3156-C {{candidate constructor (the implicit move constructor)}}
#endif
} // namespace cwg3156
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp
index 1b96005f8d442..2bb1ea1c17eb9 100644
--- a/clang/test/SemaCXX/lambda-expressions.cpp
+++ b/clang/test/SemaCXX/lambda-expressions.cpp
@@ -860,3 +860,10 @@ namespace GH26540 {
#undef NOEXCEPT17
#undef CONSTEXPR17
}
+
+namespace cwg3035 {
+static union {
+ int x = [] { return 42; }();
+ // FIXME-error at -1 {{lambda expressions are not allowed in anonymous unions}}
+};
+} // namespace cwg3035
More information about the cfe-commits
mailing list