[clang] [Clang] Initializer list on RHS of assignment (PR #100548)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 06:48:35 PDT 2024


================
@@ -101,6 +101,20 @@ static_assert(!__is_layout_compatible(StructWithAnonUnion, StructWithAnonUnion3)
 #endif
 } // namespace cwg2759
 
+namespace cwg2768 { // cwg2768: 20
+#if __cplusplus >= 201103L
+enum class E {E1};
+
+void f() {
+  E e;
+  e = E{0}; // #1
+  // cxx11-14-error at -1 {{cannot initialize a value of type 'E' with an rvalue of type 'int'}}
+  e = {0};  // #2
+  // since-cxx11-error at -1 {{cannot initialize a value of type 'E' with an rvalue of type 'int'}}
----------------
cor3ntin wrote:

can you add a test for `e = {E::E1}` ?

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


More information about the cfe-commits mailing list