The following short program gives an internal compiler error with v3.2 when compiled with -g, but compiles correctly when -g flag is not used. // ---------- template< class T > T fakemake(); template< class T > struct Identity { typedef T type; }; template< class T, class U> struct Result : public Identity< typeof( true ? fakemake<T>() : fakemake<U>() )> {}; int main () { Result<short,int>::type i = 0; return i; } Release: gcc v3.2 Environment: Cygwin
State-Changed-From-To: open->analyzed State-Changed-Why: 2.95 used to say: x.cc:14: sorry, not implemented: testing typeof_type for template parms x.cc:14: confused by earlier errors, bailing out 3.2 and present CVS say this: x.cc: In instantiation of `Identity<__typeof ((true ? fakemake<T>() : fakemake<U>()))>': x.cc:14: instantiated from here x.cc:6: internal compiler error: in is_base_type, at dwarf2out.c:7477 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu> To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org> Cc: Subject: Re: debug/8384: ICE in is_base_type, at dwarf2out.c:7477 Date: Mon, 28 Oct 2002 13:50:05 -0600 (CST) Here's a shorter example: -------------------------------- int foo; template <class T> struct Base { typedef T type; }; template<class T> struct Derived : public Base<typeof(foo)> {}; ------------------------------- Message is: ------------------------------- tmp/g> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -g x.cc x.cc: In instantiation of `Base<__typeof (foo)>': x.cc:8: instantiated from here x.cc:3: internal compiler error: in is_base_type, at dwarf2out.c:7477 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions. ------------------------------- I believe that if this problem is fixed, the code will still not compile but the next issue will then be c++/8385. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth
This is fixed on the mainline (20030526), I do not know if it works on 3.3, but since this is not a regression, I am closing as fixed: tin:~/src/gnu/gcctest>g++ -g pr8384.cc -gdwarf-2 /usr/lib/crt1.o(.text+0x18): In function `_start': : undefined reference to `main' collect2: ld returned 1 exit status