[gcc r17-2230] gccrs: Add test case to show bug is fixed

Arthur Cohen via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:e2b4cfd5ca5ce84c7ae861d7485589bf277226cf

commit r17-2230-ge2b4cfd5ca5ce84c7ae861d7485589bf277226cf
Author: Philip Herron <[email protected]>
Date:   Wed Jun 24 15:32:23 2026 +0100

    gccrs: Add test case to show bug is fixed
    
    Fixes Rust-GCC#4481
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/issue-4481.rs: New test.
    
    Signed-off-by: Philip Herron <[email protected]>

Diff:
---
 gcc/testsuite/rust/compile/issue-4481.rs | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gcc/testsuite/rust/compile/issue-4481.rs b/gcc/testsuite/rust/compile/issue-4481.rs
new file mode 100644
index 000000000000..32477d845539
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-4481.rs
@@ -0,0 +1,25 @@
+#![feature(no_core, intrinsics, staged_api, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+trait Trait<T: NewTrait> {}
+
+fn foo<T>()
+where
+    T: Trait<for<'b> fn(&'b u32)>, // { dg-error {bounds not satisfied for abi:rust fnptr .& u32 ,. -> .. .NewTrait. is not satisfied \[E0277\]} }
+{
+}
+
+impl<'a> Trait<fn(&'a u32)> for () {} // { dg-error {bounds not satisfied for abi:rust fnptr .& u32 ,. -> .. .NewTrait. is not satisfied \[E0277\]} }
+
+fn main() {
+    foo::<()>();
+}
+
+trait NewTrait {
+    type Assoc;
+    const C: Self::Assoc;
+    fn f(&self) -> Self::Assoc;
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.