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: jan@nbelvis:~/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), ...
Confirmed, this is a recent regression, it worked with "4.1.0 20050530"
Even shorter testcase: ========================== void foo() { struct A { virtual ~A() {} } a; } ==========================
Honza, this was caused by your patch http://gcc.gnu.org/ml/gcc-cvs/2005-06/msg00388.html Could you please have a look?
*** Bug 22583 has been marked as a duplicate of this bug. ***
*** Bug 23045 has been marked as a duplicate of this bug. ***
Still there in gcc-4.1-20050806.
local classes are pervasive in C++.
Subject: Bug 22034 CVSROOT: /cvs/gcc Module name: gcc Changes by: hubicka@gcc.gnu.org 2005-08-18 15:25:07 Modified files: gcc : cgraphunit.c ChangeLog Log message: PR c++/22034 * cgraphunit.c (cgraph_varpool_assemble_pending_decls): Emit debug info only for local statics, not for member variables. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cgraphunit.c.diff?cvsroot=gcc&r1=1.126&r2=1.127 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9771&r2=2.9772
Fixed.