This is the mail archive of the gcc-bugs@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]

Internal compiler error 40 (but not important)


Easily reproductible, but not vital since it only comes up when
the code contains a fatal error anyway.

"Internal compiler error" is ugly though, IMHO the compiler
should either detect the reference to a nonexistent member, or
simply throw a syntax error.

Reproduce by compiling attached code fragment.  (g++).
egcs-2.91.60 19981201 (egcs-1.1.1 release)
egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release)

If there is a problem reproducing it I'll gladly provide the
compiler "-v --save-temps" output, but I've reproduced it on
three machines.

Stumbled upon this in the process of going from C to C++, going
from structs to classes, renaming a member called string to
something else just on principle. Compiler and generated code
work as desired when the member called "string" exists, and
other problems are corrected by just renaming the member, so
there is no problem when the code is correct.

As you get closer to perfection, the bugs get less severe :-)

HAND and thank you for a very useful product.

-- 
#include <std_disclaim.h>                          Lorens Kockum
/*
 * Copyright 1999 by Solsoft
 */

#include <string>
#include <stdio.h>

int our_fprintf(FILE *, const char *, ...);

class type2 {
   public:
      char * renamed_string ;
} ;

class type1 {
 public:
   type2                *t2;
};

void test_func(type1 * t1){
	    our_fprintf(stdout, "%s\n", t1->t2->string);
}

egcs_bug.c: In function `void test_func(class type1 *)':
egcs_bug.c:21: warning: invalid use of type decl `typedef class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > string' as expression
egcs_bug.c:21: warning: cannot pass objects of type `string' through `...'
egcs_bug.c:21: Internal compiler error 40.
egcs_bug.c:21: Please submit a full bug report to `egcs-bugs@cygnus.com'.
egcs_bug.c:21: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.

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