Consider the following reduction from a wxWidgets source module: 
 
const char* GetAssertStackTrace() 
{ 
    struct StackDump 
    { 
        virtual void OnStackFrame() {} 
        const char* GetStackTrace() const; 
    }; 
    StackDump dump; 
    return dump.GetStackTrace(); 
} 
const char* stackTrace = GetAssertStackTrace(); 
 
 
Compiled with today's trunk with debugging enabled (-g), this gives: 
 
[EMAIL PROTECTED]:~/src/gcc-head $ g++ -g appbase.cpp 
appbase.cpp:12: internal compiler error: tree check: expected class 
?declaration?, have?type? (record_type) in lookup_decl_die, at dwarf2out.c:5457 
 
Strangely enough, almost any change to the code above also fixes this problem: 
removing the class declaration outside the function body, removing the empty 
body of OnStackFrame, making that function non-virtual, adding a virtual 
destructor (as one should), ...

-- 
           Summary: [4.1 regression, ICE on valid] dwarf2
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan at etpmod dot phys dot tue dot nl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-suse-linux
  GCC host triplet: i686-suse-linux
GCC target triplet: i686-suse-linux


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

Reply via email to