diff --git a/testsuite/tests/rename/should_fail/T495.hs b/testsuite/tests/rename/should_fail/T495.hs
new file mode 100644
index 0000000000000000000000000000000000000000..7fa871dfdb565234d1fcd9d31268a6b6fb410c0f
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T495.hs
@@ -0,0 +1,7 @@
+-- Regression test for #495
+
+-- inlining an undeclared identifier should give error, not panic...
+{-# INLINE blarg #-}
+
+-- even if the identifier is imported in the Prelude...
+{-# INLINE lookup #-}
diff --git a/testsuite/tests/rename/should_fail/T495.stderr b/testsuite/tests/rename/should_fail/T495.stderr
new file mode 100644
index 0000000000000000000000000000000000000000..0581807d70289d849323ff47baa06dbdc5d80cf4
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T495.stderr
@@ -0,0 +1,7 @@
+
+T495.hs:4:12: error:
+    The INLINE pragma for ‘blarg’ lacks an accompanying binding
+
+T495.hs:7:12: error:
+    The INLINE pragma for ‘lookup’ lacks an accompanying binding
+      (The INLINE pragma must be given where ‘lookup’ is declared)
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 35a317400016b477b364312b07c8e0a23c45298e..c36c4cfcf97f148ebfd5f28029596e27795d6979 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -60,6 +60,7 @@ test('rnfail056', normal, compile_fail, [''])
 test('rnfail057', normal, compile_fail, [''])
 
 test('rn_dup', normal, compile_fail, [''])
+test('T495', normal, compile_fail, [''])
 test('T2490', normal, compile_fail, [''])
 test('T2901', normal, compile_fail, [''])
 test('T2723', normal, compile, [''])  # Warnings only