aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2025-03-05 11:56:49 +0100
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2025-03-11 14:06:30 +0000
commitd6c5c64449ac4c37d529d41686da2e0dfc186435 (patch)
tree72e605d4711d9fc924b3437dcb588455edcd1c30 /gcc
parent30c9879f775664d5344629ffbd2571fb02cb077f (diff)
downloadgcc-d6c5c64449ac4c37d529d41686da2e0dfc186435.zip
gcc-d6c5c64449ac4c37d529d41686da2e0dfc186435.tar.gz
gcc-d6c5c64449ac4c37d529d41686da2e0dfc186435.tar.bz2
Add a test for enum variant name resolution
Highlight the fact that a value inside an enum definition refers to a struct outside of the enum and not to the enum variant's name directly. gcc/testsuite/ChangeLog: * rust/compile/enum_variant_name.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/rust/compile/enum_variant_name.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/enum_variant_name.rs b/gcc/testsuite/rust/compile/enum_variant_name.rs
new file mode 100644
index 0000000..671fced
--- /dev/null
+++ b/gcc/testsuite/rust/compile/enum_variant_name.rs
@@ -0,0 +1,12 @@
+// { dg-additional-options "-w -frust-name-resolution-2.0" }
+struct E1;
+
+enum Test {
+ E1 = {
+ let x = E1;
+ {
+ let x = E1;
+ }
+ 0
+ },
+}