                  try
                    Mtype.nondep_supertype
                      (Env.add_module param arg.mod_type env) param mty_res
-@@ -1429,7 +1440,7 @@
+@@ -1549,7 +1560,7 @@
          Location.print_filename intf_name
    | Not_allowed_in_functor_body ->
        fprintf ppf

       rm { mod_desc = Tmod_functor(id, name, mty, body);
            mod_type = Mty_functor(id, mty.mty_type, body.mod_type);
            mod_env = env;
@@ -845,6 +848,13 @@
         type_module (sttn && path <> None) funct_body None env sfunct in
       begin match Mtype.scrape env funct.mod_type with
         Mty_functor(param, mty_param, mty_res) as mty_functor ->
+          let impure = Ident.name param = "*" in
+          if impure then begin
+            if sarg.pmod_desc <> Pmod_structure [] then
+              raise (Error (sfunct.pmod_loc, Apply_impure));
+            if funct_body then
+              raise (Error (smod.pmod_loc, Not_allowed_in_functor_body));
+          end;
           let coercion =
             try
               Includemod.modtypes env arg.mod_type mty_param
@@ -856,6 +866,7 @@
                 Subst.modtype (Subst.add_module param path Subst.identity)
                               mty_res
             | None ->

   | With_need_typeconstr ->
       fprintf ppf
         "Only type constructors with identical parameters can be substituted."
@@ -1570,6 +1581,8 @@
       fprintf ppf "Uninterpreted extension '%s'." s
   | Recursive_module_require_explicit_type ->
       fprintf ppf "Recursive modules require an explicit module type."
+  | Apply_impure ->
+      fprintf ppf "This functor is impure. It can only be applied to ()"
 
 let report_error env ppf err =
   Printtyp.wrap_printing_env env (fun () -> report_error ppf err)
Index: typing/typemod.mli
===================================================================
--- typing/typemod.mli	(revision 14285)
+++ typing/typemod.mli	(working copy)
@@ -60,6 +60,7 @@
   | Scoping_pack of Longident.t * type_expr
   | Extension of string
   | Recursive_module_require_explicit_type
+  | Apply_impure
 
 exception Error of Location.t * Env.t * error
 
