two bugs (templates,__alignof__) in egcs (and 2.8.0)
Ulrich Lauther
ulrich.lauther@mchp.siemens.de
Mon Jan 26 07:37:00 GMT 1998
there are two template related bugs in egcs/Linux and 2.8.0 (sparc and Linux *86),
exposed by the code below:
1. When the marked line is uncommented, I get Internal Compiler Error.
this did work ok in 2.7.2.1
2. __alignof__ applied to a template parameter returns 0
----------------- snip ---------------------------
#include <stdio.h>
#define alignof(TYPE) (sizeof(struct{char c; TYPE x;}) - sizeof(TYPE))
struct C1 {
int foo;
};
template <class T>
class Foo {
public:
Foo() {
printf("alignof: %d\n",__alignof__(T)); // prints 0, should print 4
// printf("alignof: %d\n",alignof(T)); // makes compiler crash !!!
}
};
main() {
printf("align of C1: %d\n",__alignof__(C1));
printf("align of C1: %d\n",alignof(C1));
new Foo<C1>;
}
--
-lauther
----------------------------------------------------------------------------
Ulrich Lauther ph: +49 89 636 48834 fx: ... 636 42284
Siemens ZT SE 4 Internet: Ulrich.Lauther@mchp.siemens.de
More information about the Gcc
mailing list