This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug in 1.1b and 2.8.1 and snapshot 980921



The problem is still there in snapshot 981019. Further down is new
additional info which I hope is of some use for somebody who could 
solve this.

///// tst.cc /////

template
class A {
public:
  typedef T0 T;
};

template
class B {
  typedef A BC;
};

template
class C { 
public:
  typedef A AC;
};

int main() {
  return sizeof(C<3,7>::AC::T);
}

///// end /////

Compile results

> gcc-1.1b -o tst tst.cc
> ./tst; echo $?
12
> 

The return value should have been 28, assuming that sizeof(float)==4
but of some reason the two template arguments are swapped. If the
template declaration of class B is removed the problem disappears (!)

> gcc-19981019 -o tst tst.cc
tst.cc: In function `int main()':
tst.cc:19: `sizeof' applied to incomplete type `T0'
>

Better, but still a bug.

> gcc-19981019 -o --ansi --pedantic tst tst.cc
tst.cc: In function `int main()':
tst.cc:19: Internal compiler error.
tst.cc:19: Please submit a full bug report to `egcs-bugs@cygnus.com'.
>

Oops

The crash is due to segmentation violation on line 1467 in
egcs-19981019/gcc/cp/typeck.c (in c_sizeof, called from expr_sizeof line
1560, called from yyparse, called from compile_file line 2801 in file
egcs-19981019/gcc/toplev.c) There is something wrong with the tree struct 
argument 'e'.

Regards.

*/              Oskar Enoksson, Linkoping, Sweden                  /*



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]