http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58032

            Bug ID: 58032
           Summary: Bogus error: declared using local type ..., is used
                    but never defined
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/9771363

Test:

template <typename T>
struct ResultCallback {
  virtual void Run(T) = 0;
};

template <typename T>
struct FunctionResultCallback: public ResultCallback<T> {
  void Run(T a) { }
};

template <typename T>
ResultCallback<T>*
NewCallback(void (*function)(T))
{
  return new FunctionResultCallback<T>;
}

int main(int argc, char** argv) {
  struct Bar {
    static void Do(Bar*) { }
  };
  NewCallback(&Bar::Do)->Run(0);
}


Using
g++ (GCC) 4.9.0 20130730 (experimental)

pp.ii:3:16: error: 'void ResultCallback<T>::Run(T) [with T = main(int,
char**)::Bar*]', declared using local type 'main(int, char**)::Bar', is used
but never defined [-fpermissive]
   virtual void Run(T) = 0;
                ^

Broken since at least 4.7

Reply via email to