title: Invalid use of member function when using function pointers
body: <p>I have a function</p>
  
  <pre><code>void newEvent(void (*onRun)(), std::string eventName)
  </code></pre>
  
  <p>which I call like so</p>
  
  <pre><code>newEvent((*Event1)(), "Event1");
  </code></pre>
  
  <p>where Event1() is obviously a void function. This is my build output:</p>
  
  <pre><code>/home/mrasicci/Programming/SSCE/main.cpp||In member function ‘void MenuState::enter()’:|
  /home/mrasicci/Programming/SSCE/main.cpp|45|error: invalid use of member function (did you forget the ‘()’ ?)|
  ||=== Build finished: 1 errors, 0 warnings ===|
  </code></pre>
  
  <p>I have tried changing the <code>newEvent((*Event1)(), "Event1");</code> to other things such as <code>newEvent((*Event1), "Event1");</code> or <code>newEvent(Event1(), "Event1");</code> or <code>newEvent(Event1, "Event1");</code> none of which worked, all of which gave different errors. Here's the example code which gives the error, the expected output would be "Event1 triggered" but it doesn't compile:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  namespace TGE
  {
      class EventListener
      {
          public:
              typedef struct
              {
                  void (*run)();
                  bool triggered;
                  std::string name;
              } Event;
  
              void newEvent(void (*onRun)(), std::string eventName)
              {
                  Event newEvent;
                  newEvent.name = eventName;
                  newEvent.triggered = false;
                  newEvent.run = onRun;
                  eventStack.push_back(newEvent);
              }
  
              void trigger(std::string eventName)
              {
                  std::vector&lt;Event&gt;::iterator itr;
  
                  for(itr = eventStack.begin(); itr != eventStack.end(); itr++)
                  {
                      if(itr-&gt;name == eventName) itr-&gt;triggered = true;
                  }
              }
  
          protected:
              std::vector&lt;Event&gt; eventStack;
      };
  }
  
  class MenuState : protected TGE::EventListener
  {
      public:
          void enter()
          {
              newEvent((*Event1)(), "Event1");
              trigger("Event1");
  
              std::vector&lt;Event&gt;::iterator itr;
              for(itr = eventStack.begin(); itr != eventStack.end(); itr++)
              {
                  if(itr-&gt;triggered)
                  {
                      itr-&gt;run();
                      itr-&gt;triggered = false;
                  }
              }
          }
  
          void Event1()
          {
              std::cout &lt;&lt; "Event1";
          }
  };
  
  int main()
  {
      MenuState* menuState = 0;
      menuState = new MenuState();
      menuState-&gt;enter();
  
      return 0;
  }
  </code></pre>