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

            Bug ID: 58201
           Summary: [g++] Undefined reference to `B::B(void const**)'
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aivchenk at gmail dot com

Testcase:
----ABC.h-----
class A
{
 protected:
  A();
  virtual ~A();
};

class B : virtual public A
{
 public:
  B();
  virtual ~B();
};

class C
{
 private:
  class C2 : public B
   {
   public:
     C2();
     virtual ~C2();
   };
};
----AB.cpp-----
#include "ABC.h"

A::A() { }
A::~A() { }
B::B() { }
B::~B() { }

----C.cpp------
#include "ABC.h"    

C::C2::C2(){ }      
C::C2::~C2() { }    

int main ()         
{                   
    return 0;       
}                   

---------------
Compiling the usual way:
g++ AB.cpp -c
g++ C.cpp -c
g++ AB.o C.o

C.o: In function `C::C2::C2()':
C.cpp:(.text+0x23): undefined reference to `B::B(void const**)'
C.o: In function `C::C2::C2()':
C.cpp:(.text+0x8d): undefined reference to `B::B(void const**)'
C.o: In function `C::C2::~C2()':
C.cpp:(.text+0x129): undefined reference to `B::~B(void const**)'
C.o: In function `C::C2::~C2()':
C.cpp:(.text+0x1c3): undefined reference to `B::~B(void const**)'
collect2: error: ld returned 1 exit status


We cannot right now build the Android Open Source Tree with the trunk because
of that bug. It was introduced with this commit:

Author: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>                  
Date:   Thu Jul 25 17:10:21 2013 +0000                                          

        * cgraph.c (release_function_body): Break out from ...                  
        (cgraph_release_function_body): ... this one; also release DECL_RESULT  
        and DECL_ARGUMENTS.                                                     
        * ipa-cp.c (get_replacement_map): Add parm_num argument; do not set     
        old_tree in the map.                                                    
        (create_specialized_node): Update.                                      
        * lto-cgraph.c (output_node_opt_summary): Do not translate old_tree     
        into index.                                                             
        * cgraphclones.c (cgraph_create_virtual_clone): Do not copy
DECL_ARGUMENTS,                
        DECL_INITIAL and DECL_RESULT.                                           
        * ipa-prop.c (ipa_populate_param_decls): Look for origin of clones.     
        * tree-inline.c (initialize_cfun): Initialize DECL_ARGUMENTS and        
        DECL_RESULT.                                                            


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201251
138bc75d-0d04-0410-961f-82ee72b054a4

Reply via email to