 +      fprintf ppf "This functor is impure. It can only be applied to ()"
 Index: typing/typemod.mli
 ===================================================================
---- typing/typemod.mli	(revision 13274)
+--- typing/typemod.mli	(revision 13278)
 +++ typing/typemod.mli	(working copy)
 @@ -60,6 +60,7 @@
    | Not_a_packed_module of type_expr

       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,9 @@
         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 && sarg.pmod_desc <> Pmod_structure [] then
+            raise (Error (sfunct.pmod_loc, Apply_impure));
           let coercion =
             try
               Includemod.modtypes env arg.mod_type mty_param
@@ -856,6 +862,7 @@
                 Subst.modtype (Subst.add_module param path Subst.identity)
                               mty_res
             | None ->

                 try
                   Mtype.nondep_supertype
                     (Env.add_module param arg.mod_type env) param mty_res
@@ -1429,7 +1440,7 @@
         Location.print_filename intf_name
   | Not_allowed_in_functor_body ->
       fprintf ppf
-        "This kind of expression is not allowed within the body of a functor."
+        "This kind of expression is only allowed inside impure functors."
   | With_need_typeconstr ->
       fprintf ppf
         "Only type constructors with identical parameters can be substituted."
@@ -1446,3 +1457,5 @@
         "The type %a in this module cannot be exported.@ " longident lid;
       fprintf ppf
         "Its type contains local dependencies:@ %a" type_expr ty
