When using boost::bind to wrap an inline function
in a function object leads, this leads to an undefined reference to that
function.
The bug is caused because the class that produces the function object is a
template class.

GCC 3.3 and 3.4 work fine. Output from 4.0 compiler is:

$ g++-4.0 test_undefined_symb4.0.cpp -o test_undefined_symb4.0
/tmp/ccBl8CSy.o: In function `Event<int>::emit()':
test_undefined_symb4.0.cpp:(.gnu.linkonce.t._ZN5EventIiE4emitEv[Event<int>::emit()]+0x21):
undefined reference to `boost::shared_ptr<E>::get() const'
collect2: ld returned 1 exit status

$ g++-4.0 --version
g++-4.0 (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)

Attachment with example code follows.


-- 
           Summary: 4.0 regression: use of inline function in template class
                    leads to undefined reference
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter dot soetens at fmtc dot be
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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

Reply via email to