Patch for issue 5584

Adds extensible variants (see http://caml.inria.fr/mantis/view.php?id=5584)