c++ test
Eric Christopher
echristo@cygnus.com
Thu Nov 9 15:58:00 GMT 2000
This looks like valid code that's broken a couple of different ways
recently in the compiler. I don't have a fix for the most current way
(I do against the gcc that shipped in RH 7 (2), but that's of little use
right now).
Here are the two ways that this has failed:
1)
test.cc:17: invalid use of type decl `struct DATA' as expression
test.cc:17: parse error before ':' token
2)
test.cc: In function `int main ()':
test.cc:17: passing `const DATA' as `this' argument of `DATA::~DATA ()'
discards qualifiers
I believe the code is correct - though I'd love to hear if it isn't.
Should I add this as a testcase? If so, where?
-eric
#include <cstdio>
struct DATA {
DATA( void )
{
//-- Empty --
} ;
~DATA( void )
{
printf( "%-12s %04d:OK\n", __FILE__, __LINE__ ) ;
} ;
} ;
const DATA d ;
int main( void )
{
d.DATA::~DATA() ;
return( 0 ) ;
}
More information about the Gcc-bugs
mailing list