------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-18 
13:00 -------
The problem can be reduced to the following testacse:

==================================
int Sum(int);

template<int> struct A
{
    int X[Sum(2)];
    void foo() { sizeof(X); }
};

void bar()
{
    A<0> a;
    a.foo();
}
==================================

The code is invalid, since the array size "Sum(2)" is not a constant.
Even the definition 
  inline int Sum(unsigned int n) { return n*(n+1)/2; }
from the original test case doesn't change this.

The ICE was fixed by Mark's patch for PR 18429
http://gcc.gnu.org/ml/gcc-cvs/2004-11/msg00582.html
We now (i.e. in gcc 4.0.0) emit a proper error message.

Closing, since this is not a regression.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |ice-on-invalid-code
         Resolution|                            |FIXED
            Summary|internal error              |ICE on non-constant array
                   |                            |size in template
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20032

Reply via email to