This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix lookup in typedefs of the currently open class (PR c++/33516)


On Thu, Nov 01, 2007 at 03:17:51PM -0400, Jason Merrill wrote:
> I don't think it's a significant overhead; I've never seen class nesting 
> more than 3 levels.  And I was suggesting moving the !COMPLETE_TYPE_P 
> test into currently_open_class to short circuit the test for all 
> callers, not just this one.

if (COMPLETE_TYPE_P (t))
  return true;

shortcut in currently_open_class breaks bootstrap.  If I instead stick
gcc_assert (!COMPLETE_TYPE_P (t)) where currently_open_class is about to
return true, I get:

#0  fancy_abort (file=0xc55154 "../../gcc/cp/class.c", line=5617, function=0xc56750 "currently_open_class")
    at ../../gcc/diagnostic.c:659
#1  0x00000000004895d0 in currently_open_class (t=0x2aaaaeda5680) at ../../gcc/cp/class.c:5617
#2  0x0000000000457658 in resolve_typename_type (type=0x2aaaaedb4270, only_current_p=1 '\001') at ../../gcc/cp/pt.c:15780
#3  0x00000000004e244a in structural_comptypes (t1=0xc55154, t2=0x2aaaaeda85b0, strict=0) at ../../gcc/cp/typeck.c:945
#4  0x00000000004e273f in structural_comptypes (t1=0x2aaaaedb44e0, t2=0x2aaaaeda8ea0, strict=0) at ../../gcc/cp/typeck.c:1073
#5  0x00000000004aa079 in check_classfn (ctype=0x2aaaaeda5680, function=0x2aaaaedb0300, template_parms=0x0)
    at ../../gcc/cp/decl2.c:619
#6  0x000000000043089d in grokfndecl (ctype=0x2aaaaeda5680, type=0x2aaaaedb9000, declarator=<value optimized out>, 
    parms=<value optimized out>, orig_declarator=0x2aaaaeb12600, virtualp=0, flags=NO_SPECIAL, quals=0, raises=0x0, check=1, 
    friendp=0, publicp=1, inlinep=0, sfk=sfk_none, funcdef_flag=<value optimized out>, template_count=1, in_namespace=0x0, 
    attrlist=0x7fff79d1cdc8) at ../../gcc/cp/decl.c:6567
#7  0x000000000043c904 in grokdeclarator (declarator=0xc55154, declspecs=0x7fff79d1cea0, decl_context=NORMAL, initialized=1, 
    attrlist=0x7fff79d1cdc8) at ../../gcc/cp/decl.c:9045
#8  0x000000000043e497 in start_function (declspecs=0x15f1, declarator=0x1, attrs=0x0) at ../../gcc/cp/decl.c:11339

so something clearly relies on currently_open_class returning true
even for already completed classes.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]