This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
internal compiler error: int i=40;my_t<char[i]> a;
- To: gcc-bugs at gcc dot gnu dot org
- Subject: internal compiler error: int i=40;my_t<char[i]> a;
- From: Klaus Wachtler <klaus at wachtler dot de>
- Date: Sun, 15 Oct 2000 17:29:43 +0200
By mistake I wrote something like:
int isize = 40;
my_t<char[isize]> d;
I know it is not correct C++.
But i report it as a bug report since I got following compiler error:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
klaus@aw33:~ > gcc -v --save-temps e2.cpp && a.out
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di486 -D__i486 -D__i486__ e2.cpp e2.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++
/usr/local/include
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/../../../../i486-suse-linux/include
End of omitted list.
/usr/lib/gcc-lib/i486-suse-linux/2.95.2/cc1plus e2.ii -quiet -dumpbase e2.cc -version -o e2.s
GNU C++ version 2.95.2 19991024 (release) (i486-suse-linux) compiled by GNU C version 2.95.2 19991024 (release).
e2.cpp: In instantiation of `my_t<char[(({error} - 1) + 1)]>':
e2.cpp:33: instantiated from here
e2.cpp:14: Internal compiler error in `fix_lexical_addr', at function.c:5604
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
klaus@aw33:~ >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Since my e2.cpp and the e2.ii don't differ (except the comments) I
copy the little e2.cpp directly into the text:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// any template class:
template <class T> class my_t
{
int value;
T anothervalue;
public:
my_t(){};
~my_t(){};
void set( int i ) { value = i; };
int get() { return value; };
void setanother( T i ) { anothervalue = i; };
T getanother() { return anothervalue; };
};
int main( int nargs, char **args )
{
my_t<int> a; // ok
a.set( 25 );
my_t<char[40]> b; // ok
b.set( 30 );
const int csize = 40; // ok
my_t<char[csize]> c;
c.set( 33 );
// the following is nonsense; I know.
// But it does not give an error "Klaus, this is nonsense on line...".
// Instead it gives an "internal compiler error..."
int isize = 40;
my_t<char[isize]> d;
d.set( 39 );
return 0;
} /* main( int nargs, char **args ) */
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Have a nice day!
Klaus
--
----------------------------------------------------------------------
Klaus Wachtler
Breidingstr. 17
D-29614 Soltau
Tel. +49-5191-70271
+49-171-4553039
Fax: +49-5191-70272
email AnyWare@Wachtler.de
http://www.wachtler.de
----------------------------------------------------------------------
Life is too short for reboots.
----------------------------------------------------------------------