Bug 12 - more about template bugs in 2.95.2 and an ICE in 20000228
Summary: more about template bugs in 2.95.2 and an ICE in 20000228
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 3.0.x
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2000-03-01 11:36 UTC by martin
Modified: 2005-06-05 07:25 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description martin 2000-03-01 11:36:00 UTC
[Original Message-ID: <38c95d5b.330845657@busybee>]
# cat 00.cc
template <typename T>
class C {
public:
#ifdef ENUM
        enum {N = 10};
#else
        static unsigned const N (10);
#endif
        static double x [N];
};

template <typename T>
double C <T>::x [C <T>::N] = {1, 2, 3};


# g++ -S -B /usr/local/lib/gcc-lib/i586--solaris2.7/2.95.2/ 00.cc
00.cc:13: conflicting types for `double C<T>::x[C<T>::N]'
00.cc:9: previous declaration as `double C<T>::x[C<T>::N]'


# g++ -S -B /usr/local/lib/gcc-lib/i586--solaris2.7/2.95.2/ -DENUM 00.cc
######## this one passed !!!

# g++ -S -B /archive/egcs-20000228/gcc/ 00.cc
00.cc:7: Internal compiler error.
00.cc:7: Please submit a full bug report.
00.cc:7: See <URL:http://www.gnu.org/software/gcc/bugs.html> for
00.cc:7: instructions.

# g++ -S -B /archive/egcs-20000228/gcc/ -DENUM 00.cc
00.cc:13: conflicting types for `double C<T>::x[C<T>::N]'
00.cc:9: previous declaration as `double C<T>::x[10]'


Cheers!

Dima

Release:
unknown

Environment:
System: Linux mira 2.3.48 #4 Sun Feb 27 23:26:02 CET 2000 i586 unknown
Architecture: i586
Comment 1 Martin v. Loewis 2000-03-08 23:08:33 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed as a bug
Comment 2 Martin v. Loewis 2000-03-09 07:08:33 UTC
From: loewis@gcc.gnu.org
To: dvv@dvv.ru, gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de,
  nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/12
Date: 9 Mar 2000 07:08:33 -0000

 Old Synopsis: [internal] more about template bugs in 2.95.2 and an ICE in 20000228
 New Synopsis: more about template bugs in 2.95.2 and an ICE in 20000228
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: loewis
 State-Changed-When: Wed Mar  8 23:08:33 2000
 State-Changed-Why:
     Confirmed as a bug
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=12&database=gcc
Comment 3 Neil Booth 2000-11-25 07:33:32 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in CVS.  Current CVS gives:-
    
    bash-2.04$ ./g++ -B./ ~/test.c
    /home/neil/test.c:7: invalid data member initialization
    /home/neil/test.c:7: (use `=' to initialize static data members)
    /home/neil/test.c:13: conflicting types for `double C<T>::x[C<T>::N]'
    /home/neil/test.c:9: previous declaration as `double C<T>::x[C<T>::N]'
    
    Fixing the initialization:
    bash-2.04$ ./g++ -B./ ~/test.c
    /home/neil/test.c:13: conflicting types for `double C<T>::x[C<T>::N]'
    /home/neil/test.c:9: previous declaration as `double C<T>::x[C<T>::N]'
    bash-2.04$ ./g++ -B./ ~/test.c -DENUM
    /home/neil/test.c:13: conflicting types for `double C<T>::x[C<T>::N]'
    /home/neil/test.c:9: previous declaration as `double C<T>::x[10]'
Comment 4 Neil Booth 2000-11-25 15:33:33 UTC
From: neil@gcc.gnu.org
To: dvv@dvv.ru, gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de,
  nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/12
Date: 25 Nov 2000 15:33:33 -0000

 Synopsis: more about template bugs in 2.95.2 and an ICE in 20000228
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: neil
 State-Changed-When: Sat Nov 25 07:33:32 2000
 State-Changed-Why:
     Fixed in CVS.  Current CVS gives:-
     
     bash-2.04$ ./g++ -B./ ~/test.c
     /home/neil/test.c:7: invalid data member initialization
     /home/neil/test.c:7: (use `=' to initialize static data members)
     /home/neil/test.c:13: conflicting types for `double C<T>::x[C<T>::N]'
     /home/neil/test.c:9: previous declaration as `double C<T>::x[C<T>::N]'
     
     Fixing the initialization:
     bash-2.04$ ./g++ -B./ ~/test.c
     /home/neil/test.c:13: conflicting types for `double C<T>::x[C<T>::N]'
     /home/neil/test.c:9: previous declaration as `double C<T>::x[C<T>::N]'
     bash-2.04$ ./g++ -B./ ~/test.c -DENUM
     /home/neil/test.c:13: conflicting types for `double C<T>::x[C<T>::N]'
     /home/neil/test.c:9: previous declaration as `double C<T>::x[10]'
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=12&database=gcc