the order of tests stable and easily looking up whether a test name
    exists.  */
 
-static std::map<std::string, std::unique_ptr<selftest>> tests;
+static std::map<std::string, std::function<void(void)>> tests;
 
 /* See selftest.h.  */
 
 void
-register_test (const std::string &name, selftest *test)
+register_test (const std::string &name,
+              std::function<void(void)> function)
 {
   /* Check that no test with this name already exist.  */
   gdb_assert (tests.find (name) == tests.end ());
 
-  tests[name] = std::unique_ptr<selftest> (test);
-}
-
-/* A selftest that calls the test function without arguments.  */
-
-struct lambda_selftest : public selftest
-{
-  lambda_selftest (std::function<void(void)> function_)
-  {
-    function  = function_;
-  }
-
-  void operator() () const override
-  {
-    function ();
-  }
-
-  std::function<void(void)> function;
-};
-
-/* See selftest.h.  */
-
-void
-register_test (const std::string &name,
-              std::function<void(void)> function)
-{
-  register_test (name, new lambda_selftest (function));
+  tests[name] = function;
 }
 
 /* See selftest.h.  */
   for (const auto &pair : tests)
     {
       const std::string &name = pair.first;
-      const std::unique_ptr<selftest> &test = pair.second;
+      const auto &test = pair.second;
       bool run = false;
 
       if (filters.empty ())
        {
          debug_printf (_("Running selftest %s.\n"), name.c_str ());
          ++ran;
-         (*test) ();
+         test ();
        }
       catch (const gdb_exception_error &ex)
        {
 
 /* A test is just a function that does some checks and throws an
    exception if something has gone wrong.  */
 
-typedef void self_test_function (void);
-
 namespace selftests
 {
 
-/* Interface for the various kinds of selftests.  */
-
-struct selftest
-{
-  virtual ~selftest () = default;
-  virtual void operator() () const = 0;
-};
-
 /* True if selftest should run verbosely.  */
 
 extern bool run_verbose ();
 
 /* Register a new self-test.  */
 
-extern void register_test (const std::string &name, selftest *test);
-
-/* Register a new self-test.  */
-
 extern void register_test (const std::string &name,
                           std::function<void(void)> function);