gcc/rust/ChangeLog:
* rust-gcc.cc (constructor_expression):
Ensure vec_alloc reserves at least one element.
gcc/testsuite/ChangeLog:
* rust/compile/issue-3947.rs: New test.
Signed-off-by: lishin <lishin1008@gmail.com>
return error_mark_node;
vec<constructor_elt, va_gc> *init;
- vec_alloc (init, vals.size ());
+ vec_alloc (init, union_index != -1 ? 1 : vals.size ());
tree sink = NULL_TREE;
bool is_constant = true;
--- /dev/null
+enum _Enum {
+ A(),
+}
+
+type _E = _Enum;
+
+// { dg-warning "function is never used: '_a'" "" { target *-*-* } .+1 }
+const fn _a() -> _Enum {
+ _E::A()
+}