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]

c++ test


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 ) ;
}

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