aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaisal Abbas <90.abbasfaisal@gmail.com>2022-09-04 16:18:40 +0100
committerFaisal Abbas <90.abbasfaisal@gmail.com>2022-09-04 17:49:44 +0100
commita876e9e8f0c48b476116b0f5808ab32dfb520f56 (patch)
treef28c4471e451f3cea477b29fabf27d35ed8a030b
parenta4f07c8391287c4cc95900f86e16b0f667396f36 (diff)
downloadgcc-a876e9e8f0c48b476116b0f5808ab32dfb520f56.zip
gcc-a876e9e8f0c48b476116b0f5808ab32dfb520f56.tar.gz
gcc-a876e9e8f0c48b476116b0f5808ab32dfb520f56.tar.bz2
add testcase to test component_ref and constructor codes in eval_constant_expression()
-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;
+}
+