This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: internal compiler error with typeof in templates
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Re: internal compiler error with typeof in templates
- From: Martin Berger <martinb at dcs dot qmw dot ac dot uk>
- Date: Thu, 22 Feb 2001 20:23:53 +0000
- Organization: Department of Computer Science, QMW.
> | i reported this problem a few days ago, but i tested it using an old
> | compiler. i still get an internal compiler error from the following
> | little piece of code under gcc 2.95.2, so here it is again:
> |
> | template <typename A>
> | typeof( *(A*)NULL ) test(){};
>
> Well, I must be missing the relation between the subject (about
> typedef) and that construct, but what kind of behaviour are you
> expecting from dereferencing a null pointer?
well, in the first place not an internal compiler error ...
this code is not supposed to be executed, it is just for
template constraints checking. for example the following
compiles and runs quite nicely:
#include <iostream>
typeof( *(int*)( NULL )) test(){ return 3; };
int main( int, char** )
{
cout << "test = " << test() << endl;
}
i'm not sure the original code is valid, but the compiler should
behave more reasonably
sorry about "typedef" though. i meant to say "typeof"!
martin