diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-03-29 17:02:17 +0100 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2023-03-30 14:44:06 +0100 |
commit | ea9ae4044000496714d3f0c58f3dba21487247ac (patch) | |
tree | 01fd0f7309d10a74165a6b195f09cddcf7c6be9a | |
parent | 7851d384452728deccaac13db6d335e0c1f28651 (diff) | |
download | gcc-ea9ae4044000496714d3f0c58f3dba21487247ac.zip gcc-ea9ae4044000496714d3f0c58f3dba21487247ac.tar.gz gcc-ea9ae4044000496714d3f0c58f3dba21487247ac.tar.bz2 |
gccrs: Add test to show multiple candidates for methods is working
Fixes #925
gcc/testsuite/ChangeLog:
* rust/compile/issue-925.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
-rw-r--r-- | gcc/testsuite/rust/compile/issue-925.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-925.rs b/gcc/testsuite/rust/compile/issue-925.rs new file mode 100644 index 0000000..f6c0719 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-925.rs @@ -0,0 +1,23 @@ +struct S; +trait A { + fn foo(&self); +} + +trait B: A { + fn foo(&self); +} + +impl A for S { + fn foo(&self) {} +} + +impl B for S { + fn foo(&self) {} +} + +fn test() { + let a = S; + a.foo(); + // { dg-error "multiple candidates found for method .foo." "" { target *-*-* } .-1 } + // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 } +} |