diff --git a/compiler/rustc_middle/src/mir/interpret/queries.rs b/compiler/rustc_middle/src/mir/interpret/queries.rs
index f53dc8cb0ec13..ae32a54be3ded 100644
--- a/compiler/rustc_middle/src/mir/interpret/queries.rs
+++ b/compiler/rustc_middle/src/mir/interpret/queries.rs
@@ -95,7 +95,10 @@ impl<'tcx> TyCtxt<'tcx> {
                     // used generic parameters is a bug of evaluation, so checking for it
                     // here does feel somewhat sensible.
                     if !self.features().generic_const_exprs && ct.substs.has_non_region_param() {
-                        assert!(matches!(self.def_kind(ct.def), DefKind::AnonConst));
+                        assert!(matches!(
+                            self.def_kind(ct.def),
+                            DefKind::InlineConst | DefKind::AnonConst
+                        ));
                         let mir_body = self.mir_for_ctfe(ct.def);
                         if mir_body.is_polymorphic {
                             let Some(local_def_id) = ct.def.as_local() else { return };
diff --git a/tests/ui/match/issue-112438.rs b/tests/ui/match/issue-112438.rs
new file mode 100644
index 0000000000000..15f380f7fb471
--- /dev/null
+++ b/tests/ui/match/issue-112438.rs
@@ -0,0 +1,11 @@
+// run-pass
+#![feature(inline_const_pat)]
+#![allow(dead_code)]
+#![allow(incomplete_features)]
+fn foo<const V: usize>() {
+    match 0 {
+        const { 1 << 5 } | _ => {}
+    }
+}
+
+fn main() {}