aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaisal Abbas <90.abbasfaisal@gmail.com>2022-09-04 16:18:40 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2023-01-31 14:16:51 +0100
commitb0ff1647cbe682b681ab9abaed3315b6b03c20fc (patch)
tree965eba18a4d5feffae914ce728db46dddc490079
parent689a5c6711b8217158988763ba25959f8112dcfc (diff)
downloadgcc-b0ff1647cbe682b681ab9abaed3315b6b03c20fc.zip
gcc-b0ff1647cbe682b681ab9abaed3315b6b03c20fc.tar.gz
gcc-b0ff1647cbe682b681ab9abaed3315b6b03c20fc.tar.bz2
gccrs: add testcase to test component_ref and constructor codes in eval_constant_expression()
gcc/testsuite/ChangeLog: * rust/compile/const7.rs: New test. Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
-rw-r--r--gcc/testsuite/rust/compile/const7.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/const7.rs b/gcc/testsuite/rust/compile/const7.rs
new file mode 100644
index 0000000..a7431c0
--- /dev/null
+++ b/gcc/testsuite/rust/compile/const7.rs
@@ -0,0 +1,12 @@
+// { dg-options "-w -O0 -fdump-tree-gimple" }
+struct Foo(usize, usize);
+
+const A:Foo = Foo(123, 4546);
+
+const B:usize = A.0;
+
+fn main() {
+ // { dg-final { scan-tree-dump-times {b = 123} 1 gimple } }
+ let b = B;
+}
+