From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8960 invoked by alias); 22 Feb 2004 22:40:54 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8953 invoked by uid 48); 22 Feb 2004 22:40:53 -0000 Date: Sun, 22 Feb 2004 22:40:00 -0000 From: "schmid at snake dot iap dot physik dot tu-darmstadt dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20040222224050.14246.schmid@snake.iap.physik.tu-darmstadt.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/14246] New: Problems with templates, ice in write_template_arg_literal X-Bugzilla-Reason: CC X-SW-Source: 2004-02/txt/msg02115.txt.bz2 List-Id: The followimg file, stripped down from the file types/types.C from the book C++ Template - The Complete Guide by David Vandevoorde and Nicolai M. Josuttis, causes an ice. It used to work with earlier versions of gcc 3.4. Gcc 3.3 has no problems compiling this imho valid source code. source code d.C template class IsFundaT { public: enum { Yes = 0, No = 1}; }; template<> class IsFundaT { public: enum { Yes = 1, No = 0 }; }; template<> class IsFundaT { public: enum { Yes = 1, No = 0 }; }; template<> class IsFundaT { public: enum { Yes = 1, No = 0 }; }; template<> class IsFundaT { public: enum { Yes = 1, No = 0 }; }; template class IsFunctionT { private: typedef char One; typedef struct { char a[2]; } Two; template static One test(...); template static Two test(U (*)[1]); public: enum { Yes = sizeof(IsFunctionT::template test(0)) == 1 }; enum { No = !Yes }; }; template class CompoundT { public: enum { IsPtrT = 0, IsRefT = 0, IsArrayT = 0, IsFuncT = IsFunctionT::Yes, IsPtrMemT = 0 }; typedef T BaseT; typedef T BottomT; typedef CompoundT ClassT; }; struct SizeOverOne { char c[2]; }; template::IsFuncT> class ConsumeUDC { public: operator T() const; }; template class ConsumeUDC { }; template class ConsumeUDC { }; char enum_check(bool); char enum_check(signed int); char enum_check(unsigned int); SizeOverOne enum_check(...); template class IsEnumT { public: enum { Yes = IsFundaT::No && sizeof(enum_check(ConsumeUDC()))==1 }; enum { No = !Yes }; }; template class TypeT { public: enum { IsFundaT = IsFundaT::Yes, IsEnumT = IsEnumT::Yes } ; }; template void check() { if (TypeT::IsFundaT) { return 1;} } int main() { check(); } g++ -W -Wall d.C -v Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs Configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c++,f77,objc --enable-__cxa_atexit --enable-libstdcxx-debug Thread model: posix gcc version 3.4.0 20040221 (prerelease) /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -quiet -v -D_GNU_SOURCE d.C -quiet -dumpbase d.C -mtune=pentiumpro -auxbase d -W -Wall -version -o /tmp/ccSfyb76.s ignoring nonexistent directory "NONE/include" ignoring nonexistent directory "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/i686-pc-linux-gnu /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/backward /usr/local/include /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include /usr/include End of search list. GNU C++ version 3.4.0 20040221 (prerelease) (i686-pc-linux-gnu) compiled by GNU C version 3.4.0 20040221 (prerelease). GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64274 d.C: In instantiation of `IsEnumT': d.C:72: instantiated from `TypeT' d.C:79: instantiated from `void check() [with T = int]' d.C:85: instantiated from here d.C:63: internal compiler error: in write_template_arg_literal, at cp/mangle.c:2125 Please submit a full bug report, with preprocessed source if appropriate. -- Summary: Problems with templates, ice in write_template_arg_literal Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P1 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schmid at snake dot iap dot physik dot tu-darmstadt dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14246