[Bug c++/11367] undefined references for static template member functions

richard dot kreckel at ginac dot de gcc-bugzilla@gcc.gnu.org
Sun Jun 29 11:19:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From richard dot kreckel at ginac dot de  2003-06-29 11:19 -------
Wooops, I just discovered that changing the ctor like this makes it work:

template <typename T>
struct managed {
    bool (*_gc_fun) (void*);  // A hook for garbage collection
    T data;
    managed (const T& t) : _gc_fun (managed<T>::no_gc), data(t) { }  // <===
    ~managed() { }
    static bool no_gc (void*) { return false; }
};


Is this really correct behaviour?  I don't think so.  It does not seem to be one
of the usual two-stage lookup problems since there is nothing ambiguous about
the static function no_gc(void*).  But maybe I'm wrong...
  
If it is correct, please feel free to change this bug's resolution to INVALID.



More information about the Gcc-bugs mailing list