aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorLiam Naddell <liam.naddell@mail.utoronto.ca>2024-07-12 20:56:08 -0400
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-17 16:35:53 +0100
commit75dce4d629249a31bebd5e58e6f13e5d3df04711 (patch)
tree2a10a4e7e6fa7a9a525cd560e33ab726ada6656a /gcc/testsuite
parentf89b07d3589d071b9b158e8c744f2006f8359f12 (diff)
downloadgcc-75dce4d629249a31bebd5e58e6f13e5d3df04711.zip
gcc-75dce4d629249a31bebd5e58e6f13e5d3df04711.tar.gz
gcc-75dce4d629249a31bebd5e58e6f13e5d3df04711.tar.bz2
gccrs: [gccrs#3046] ICE on failing to find enum variant
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc: Fix ICE caused by not finding enum variant by adding new error message gcc/testsuite/ChangeLog: * rust/compile/issue-3046.rs: Add test for new error message Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/rust/compile/issue-3046.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-3046.rs b/gcc/testsuite/rust/compile/issue-3046.rs
new file mode 100644
index 0000000..c982cc9
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-3046.rs
@@ -0,0 +1,23 @@
+enum Res {
+ OK,
+ BAD,
+}
+
+enum LOption {
+ Some(i32),
+ None,
+}
+
+fn test(v: LOption) -> Res {
+ return Res::BAD;
+}
+
+
+fn main() {
+ // Should be:
+ // test(LOption::Some(2));
+ //
+ test(LOption(2));
+ // { dg-error "expected function, tuple struct or tuple variant, found enum" "" { target *-*-* } .-1 }
+ // { dg-error "failed to resolve type for argument expr in CallExpr" "" { target *-*-* } .-2 }
+}