From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10101 invoked by alias); 4 Sep 2004 18:55:24 -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 10064 invoked by uid 48); 4 Sep 2004 18:55:22 -0000 Date: Sat, 04 Sep 2004 18:55:00 -0000 From: "niemayer at isg dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20040904185519.17323.niemayer@isg.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17323] New: ICE on invalid code if static member array initialized with size computed as division by zero X-Bugzilla-Reason: CC X-SW-Source: 2004-09/txt/msg00389.txt.bz2 List-Id: The following tiny piece of C++ code causes an ICE: ---------------------- ice.cxx -------------------------------------- template class A { static const int x = 1024/sizeof(T); static char i[x]; }; class B : public A { }; ------------------------------------------------------------------- Output after "gcc -c ice.cxx" is: ice.cxx: In instantiation of `A': ice.cxx:8: instantiated from here ice.cxx:4: error: invalid application of `sizeof' to incomplete type `B' ice.cxx:4: warning: division by zero in `1024 / 0' gcc: Internal error: Segmentation fault (program cc1plus) Please submit a full bug report. BTW: I would be very interested to hear if there's a legal (compile-time) equivalent to the code above - so far I've found only clumsy work-arounds that need run-time tests. -- Summary: ICE on invalid code if static member array initialized with size computed as division by zero Product: gcc Version: 3.4.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: niemayer at isg dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17323