diff --git a/loopy/auto_test.py b/loopy/auto_test.py
index efc1fa3bbfb9f67d2be72f74c8be33679e2b9beb..690e2bec2492eb19e029b5ad1b4f4e9919ceb3ba 100644
--- a/loopy/auto_test.py
+++ b/loopy/auto_test.py
@@ -324,6 +324,15 @@ def _enumerate_cl_devices_for_ref_test():
 
 # {{{ main automatic testing entrypoint
 
+def _complain_about_deferred_types(knl):
+    print "COMPL"
+    for arg in knl.args:
+        if arg.dtype is None:
+            raise RuntimeError("Automatic testing requires that all "
+                    "argument types are known.  Argument '%s' has "
+                    "an unknown/deferred type." % arg.name)
+
+
 def auto_test_vs_ref(
         ref_knl, ctx, test_knl, op_count=[], op_label=[], parameters={},
         print_ref_code=False, print_code=True, warmup_rounds=2,
@@ -375,6 +384,8 @@ def auto_test_vs_ref(
 
     # {{{ compile and run reference code
 
+    _complain_about_deferred_types(ref_knl)
+
     found_ref_device = False
 
     ref_errors = []
@@ -475,6 +486,7 @@ def auto_test_vs_ref(
             test_kernels = [test_knl]
 
     for i, kernel in enumerate(test_kernels):
+        _complain_about_deferred_types(kernel)
         compiled = CompiledKernel(ctx, kernel, options=options,
                 codegen_kwargs=codegen_kwargs)