This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error, C++, templates and static_cast<>()
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Internal compiler error, C++, templates and static_cast<>()
- From: "George T. Talbot" <george at moberg dot com>
- Date: Fri, 31 Mar 2000 18:00:35 -0500 (EST)
Got an internal compiler error for you. Compiling with templates and
static_cast<> causes it. This is the first time I've submitted a compiler
bug report (to my knowledge). I'm using the instructions at:
http://www.gnu.org/software/gcc/bugs.html
If you need any more information, let me know...
--
George T. Talbot
<george at moberg dot com>
P.S. Here's the output of "g++ -v --save-temps weird_problem.cc":
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/lib/gcc-lib/i586-mandrake-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__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__ weird_problem.cc weird_problem.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3
/usr/local/include
/usr/lib/gcc-lib/i586-mandrake-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/i586-mandrake-linux/2.95.2/../../../../i586-mandrake-linux/include
End of omitted list.
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/cc1plus weird_problem.ii -quiet -dumpbase weird_problem.cc -version -o weird_problem.s
GNU C++ version 2.95.2 19991024 (release) (i586-mandrake-linux) compiled by GNU C version 2.95.2 19991024 (release).
weird_problem.cc: In function `int main(int, char **)':
weird_problem.cc:40: Internal compiler error.
weird_problem.cc:40: Please submit a full bug report.
weird_problem.cc:40: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for instructions.
# 1 "weird_problem.cc"
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/iostream" 1 3
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/iostream.h" 1 3
#pragma interface
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/streambuf.h" 1 3
#pragma interface
extern "C" {
# 1 "/usr/include/libio.h" 1 3
# 1 "/usr/include/_G_config.h" 1 3
# 1 "/usr/include/bits/types.h" 1 3
# 1 "/usr/include/features.h" 1 3
# 138 "/usr/include/features.h" 3
# 196 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 71 "/usr/include/sys/cdefs.h" 3
# 103 "/usr/include/sys/cdefs.h" 3
# 250 "/usr/include/features.h" 2 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 278 "/usr/include/features.h" 2 3
# 26 "/usr/include/bits/types.h" 2 3
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 1 3
# 19 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 61 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 131 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
typedef unsigned int size_t;
# 271 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 283 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 317 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 29 "/usr/include/bits/types.h" 2 3
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;
__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 48 "/usr/include/bits/types.h" 3
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;
typedef __quad_t *__qaddr_t;
typedef __u_quad_t __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef long int __rlim_t;
typedef __quad_t __rlim64_t;
typedef __u_int __id_t;
typedef struct
{
int __val[2];
} __fsid_t;
typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef long int __swblk_t;
typedef long int __clock_t;
typedef unsigned long int __fd_mask;
typedef struct
{
__fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask)) ];
} __fd_set;
typedef int __key_t;
typedef unsigned short int __ipc_pid_t;
typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;
typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;
typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
typedef __u_long __ino64_t;
typedef __loff_t __off64_t;
typedef long int __t_scalar_t;
typedef unsigned long int __t_uscalar_t;
typedef int __intptr_t;
# 9 "/usr/include/_G_config.h" 2 3
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 1 3
# 19 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 61 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 131 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 188 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
typedef unsigned int wint_t;
# 317 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 14 "/usr/include/_G_config.h" 2 3
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 30 "/usr/include/libio.h" 2 3
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stdarg.h" 1 3
typedef void *__gnuc_va_list;
# 122 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stdarg.h" 3
# 209 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stdarg.h" 3
# 48 "/usr/include/libio.h" 2 3
# 67 "/usr/include/libio.h" 3
# 98 "/usr/include/libio.h" 3
struct _IO_jump_t; struct _IO_FILE;
typedef void _IO_lock_t;
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
int _pos;
# 186 "/usr/include/libio.h" 3
};
struct _IO_FILE {
int _flags;
char* _IO_read_ptr;
char* _IO_read_end;
char* _IO_read_base;
char* _IO_write_base;
char* _IO_write_ptr;
char* _IO_write_end;
char* _IO_buf_base;
char* _IO_buf_end;
char *_IO_save_base;
char *_IO_backup_base;
char *_IO_save_end;
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
int _blksize;
__off_t _old_offset;
unsigned short _cur_column;
signed char _vtable_offset;
char _shortbuf[1];
_IO_lock_t *_lock;
__off64_t _offset;
int _unused2[16];
};
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
typedef __ssize_t __io_read_fn (void * __cookie, char *__buf,
size_t __nbytes) ;
typedef __ssize_t __io_write_fn (void * __cookie, __const char *__buf,
size_t __n) ;
typedef int __io_seek_fn (void * __cookie, __off_t __pos, int __w) ;
typedef int __io_close_fn (void * __cookie) ;
# 311 "/usr/include/libio.h" 3
extern "C" {
extern int __underflow (_IO_FILE *) throw () ;
extern int __uflow (_IO_FILE *) throw () ;
extern int __overflow (_IO_FILE *, int) throw () ;
extern int _IO_getc (_IO_FILE *__fp) throw () ;
extern int _IO_putc (int __c, _IO_FILE *__fp) throw () ;
extern int _IO_feof (_IO_FILE *__fp) throw () ;
extern int _IO_ferror (_IO_FILE *__fp) throw () ;
extern int _IO_peekc_locked (_IO_FILE *__fp) throw () ;
extern void _IO_flockfile (_IO_FILE *) throw () ;
extern void _IO_funlockfile (_IO_FILE *) throw () ;
extern int _IO_ftrylockfile (_IO_FILE *) throw () ;
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
__gnuc_va_list , int *__restrict) throw () ;
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
__gnuc_va_list ) throw () ;
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t ) throw () ;
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t ) throw () ;
extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t , int, int) throw () ;
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t , int) throw () ;
extern void _IO_free_backup_area (_IO_FILE *) throw () ;
}
# 36 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/streambuf.h" 2 3
}
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stdarg.h" 1 3
void va_end (__gnuc_va_list);
# 175 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stdarg.h" 3
typedef __gnuc_va_list va_list;
# 40 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/streambuf.h" 2 3
extern "C++" {
class istream;
class ostream; class streambuf;
typedef __off64_t streamoff;
typedef __off64_t streampos;
typedef __ssize_t streamsize;
typedef unsigned long __fmtflags;
typedef unsigned char __iostate;
struct _ios_fields
{
streambuf *_strbuf;
ostream* _tie;
int _width;
__fmtflags _flags;
wchar_t _fill;
__iostate _state;
__iostate _exceptions;
int _precision;
void *_arrays;
};
# 124 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/streambuf.h" 3
class ios : public _ios_fields {
ios& operator=(ios&);
ios (const ios&);
public:
typedef __fmtflags fmtflags;
typedef int iostate;
typedef int openmode;
typedef __ssize_t streamsize;
enum io_state {
goodbit = 0 ,
eofbit = 1 ,
failbit = 2 ,
badbit = 4 };
enum open_mode {
in = 1 ,
out = 2 ,
ate = 4 ,
app = 8 ,
trunc = 16 ,
nocreate = 32 ,
noreplace = 64 ,
bin = 128 ,
binary = 128 };
enum seek_dir { beg, cur, end};
typedef enum seek_dir seekdir;
enum { skipws= 01 ,
left= 02 , right= 04 , internal= 010 ,
dec= 020 , oct= 040 , hex= 0100 ,
showbase= 0200 , showpoint= 0400 ,
uppercase= 01000 , showpos= 02000 ,
scientific= 04000 , fixed= 010000 ,
unitbuf= 020000 , stdio= 040000
};
enum {
basefield=dec+oct+hex,
floatfield = scientific+fixed,
adjustfield = left+right+internal
};
# 177 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/streambuf.h" 3
ostream* tie() const { return _tie; }
ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
wchar_t fill() const { return _fill; }
wchar_t fill(wchar_t newf)
{wchar_t oldf = _fill; _fill = newf; return oldf;}
fmtflags flags() const { return _flags; }
fmtflags flags(fmtflags new_val) {
fmtflags old_val = _flags; _flags = new_val; return old_val; }
int precision() const { return _precision; }
int precision(int newp) {
unsigned short oldp = _precision; _precision = (unsigned short)newp;
return oldp; }
fmtflags setf(fmtflags val) {
fmtflags oldbits = _flags;
_flags |= val; return oldbits; }
fmtflags setf(fmtflags val, fmtflags mask) {
fmtflags oldbits = _flags;
_flags = (_flags & ~mask) | (val & mask); return oldbits; }
fmtflags unsetf(fmtflags mask) {
fmtflags oldbits = _flags;
_flags &= ~mask; return oldbits; }
int width() const { return _width; }
int width(int val) { int save = _width; _width = val; return save; }
void _throw_failure() const { }
void clear(iostate state = 0) {
_state = _strbuf ? state : state|badbit;
if (_state & _exceptions) _throw_failure(); }
void set(iostate flag) { _state |= flag;
if (_state & _exceptions) _throw_failure(); }
void setstate(iostate flag) { _state |= flag;
if (_state & _exceptions) _throw_failure(); }
int good() const { return _state == 0; }
int eof() const { return _state & ios::eofbit; }
int fail() const { return _state & (ios::badbit|ios::failbit); }
int bad() const { return _state & ios::badbit; }
iostate rdstate() const { return _state; }
operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
int operator!() const { return fail(); }
iostate exceptions() const { return _exceptions; }
void exceptions(iostate enable) {
_exceptions = enable;
if (_state & _exceptions) _throw_failure(); }
streambuf* rdbuf() const { return _strbuf; }
streambuf* rdbuf(streambuf *_s) {
streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; }
static int sync_with_stdio(int on);
static void sync_with_stdio() { sync_with_stdio(1); }
static fmtflags bitalloc();
static int xalloc();
void*& pword(int);
void* pword(int) const;
long& iword(int);
long iword(int) const;
class Init {
public:
Init () { }
};
protected:
inline ios(streambuf* sb = 0, ostream* tie_to = 0);
inline virtual ~ios();
inline void init(streambuf* sb, ostream* tie = 0);
};
typedef ios::seek_dir _seek_dir;
class streammarker : private _IO_marker {
friend class streambuf;
void set_offset(int offset) { _pos = offset; }
public:
streammarker(streambuf *sb);
~streammarker();
int saving() { return 1; }
int delta(streammarker&);
int delta();
};
struct streambuf : public _IO_FILE {
friend class ios;
friend class istream;
friend class ostream;
friend class streammarker;
const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); }
protected:
static streambuf* _list_all;
_IO_FILE*& xchain() { return _chain; }
void _un_link();
void _link_in();
char* gptr() const
{ return _flags & 0x100 ? _IO_save_base : _IO_read_ptr; }
char* pptr() const { return _IO_write_ptr; }
char* egptr() const
{ return _flags & 0x100 ? _IO_save_end : _IO_read_end; }
char* epptr() const { return _IO_write_end; }
char* pbase() const { return _IO_write_base; }
char* eback() const
{ return _flags & 0x100 ? _IO_save_base : _IO_read_base;}
char* base() const { return _IO_buf_base; }
char* ebuf() const { return _IO_buf_end; }
int blen() const { return _IO_buf_end - _IO_buf_base; }
void xput_char(char c) { *_IO_write_ptr++ = c; }
int xflags() { return _flags ; }
int xflags(int f) {int fl = _flags ; _flags = f; return fl;}
void xsetflags(int f) { _flags |= f; }
void xsetflags(int f, int mask)
{ _flags = (_flags & ~mask) | (f & mask); }
void gbump(int n)
{ _flags & 0x100 ? (_IO_save_base+=n):(_IO_read_ptr+=n);}
void pbump(int n) { _IO_write_ptr += n; }
void setb(char* b, char* eb, int a=0);
void setp(char* p, char* ep)
{ _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; }
void setg(char* eb, char* g, char *eg) {
if (_flags & 0x100 ) _IO_free_backup_area(this);
_IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; }
char *shortbuf() { return _shortbuf; }
int in_backup() { return _flags & 0x100 ; }
char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; }
char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; }
char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; }
char *Bptr() { return _IO_backup_base; }
char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; }
char *Nbase() { return _IO_save_base; }
char *eNptr() { return _IO_save_end; }
int have_backup() { return _IO_save_base != __null ; }
int have_markers() { return _markers != __null ; }
void free_backup_area();
void unsave_markers();
int put_mode() { return _flags & 0x800 ; }
int switch_to_get_mode();
streambuf(int flags=0);
public:
static int flush_all();
static void flush_all_linebuffered();
virtual ~streambuf();
virtual int overflow(int c = (-1) );
virtual int underflow();
virtual int uflow();
virtual int pbackfail(int c);
virtual streamsize xsputn(const char* s, streamsize n);
virtual streamsize xsgetn(char* s, streamsize n);
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
streampos pubseekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out)
{ return _IO_seekoff (this, o, d, mode); }
streampos pubseekpos(streampos pos, int mode = ios::in|ios::out)
{ return _IO_seekpos (this, pos, mode); }
streampos sseekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
streampos sseekpos(streampos pos, int mode = ios::in|ios::out);
virtual streambuf* setbuf(char* p, int len);
virtual int sync();
virtual int doallocate();
int seekmark(streammarker& mark, int delta = 0);
int sputbackc(char c);
int sungetc();
int unbuffered() { return _flags & 2 ? 1 : 0; }
int linebuffered() { return _flags & 0x200 ? 1 : 0; }
void unbuffered(int i)
{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
void linebuffered(int i)
{ if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
int allocate() {
if (base() || unbuffered()) return 0;
else return doallocate(); }
void allocbuf() { if (base() == __null ) doallocbuf(); }
void doallocbuf();
int in_avail() { return _IO_read_end - _IO_read_ptr; }
int out_waiting() { return _IO_write_ptr - _IO_write_base; }
streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); }
streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); }
streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); }
int ignore(int);
int get_column();
int set_column(int);
long sgetline(char* buf, size_t n, char delim, int putback_delim);
int sputc(int c) { return _IO_putc(c, this); }
int sbumpc() { return _IO_getc(this); }
int sgetc() { return (( this )->_IO_read_ptr >= ( this )->_IO_read_end && __underflow ( this ) == (-1) ? (-1) : *(unsigned char *) ( this )->_IO_read_ptr) ; }
int snextc() {
if (_IO_read_ptr >= _IO_read_end && __underflow(this) == (-1) )
return (-1) ;
else return _IO_read_ptr++, sgetc(); }
void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; }
int vscan(char const *fmt0, __gnuc_va_list ap, ios* stream = __null );
int scan(char const *fmt0 ...);
int vform(char const *fmt0, __gnuc_va_list ap);
int form(char const *fmt0 ...);
virtual streamsize sys_read(char* buf, streamsize size);
virtual streamsize sys_write(const char*, streamsize);
virtual streampos sys_seek(streamoff, _seek_dir);
virtual int sys_close();
virtual int sys_stat(void*);
virtual int showmanyc();
virtual void imbue(void *);
};
class filebuf : public streambuf {
protected:
void init();
public:
static const int openprot;
filebuf();
filebuf(int fd);
filebuf(int fd, char* p, int len);
~filebuf();
filebuf* attach(int fd);
filebuf* open(const char *filename, const char *mode);
filebuf* open(const char *filename, ios::openmode mode, int prot = 0664);
virtual int underflow();
virtual int overflow(int c = (-1) );
int is_open() const { return _fileno >= 0; }
int fd() const { return is_open() ? _fileno : (-1) ; }
filebuf* close();
virtual int doallocate();
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
virtual streambuf* setbuf(char* p, int len);
streamsize xsputn(const char* s, streamsize n);
streamsize xsgetn(char* s, streamsize n);
virtual int sync();
protected:
int is_reading() { return eback() != egptr(); }
char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
char* file_ptr() { return eGptr(); }
virtual streamsize sys_read(char* buf, streamsize size);
virtual streampos sys_seek(streamoff, _seek_dir);
virtual streamsize sys_write(const char*, streamsize);
virtual int sys_stat(void*);
virtual int sys_close();
};
inline void ios::init(streambuf* sb, ostream* tie_to) {
_state = sb ? ios::goodbit : ios::badbit; _exceptions=0;
_strbuf=sb; _tie = tie_to; _width=0; _fill=' ';
_flags=ios::skipws|ios::dec;
_precision=6; _arrays = 0; }
inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); }
inline ios::~ios() {
operator delete[] (_arrays);
}
}
# 31 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/iostream.h" 2 3
extern "C++" {
class istream; class ostream;
typedef ios& (*__manip)(ios&);
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);
class ostream : virtual public ios
{
void do_osfx();
public:
ostream() { }
ostream(streambuf* sb, ostream* tied= __null );
int opfx() {
if (!good()) return 0;
else { if (_tie) _tie->flush(); ; return 1;} }
void osfx() { ;
if (flags() & (ios::unitbuf|ios::stdio))
do_osfx(); }
ostream& flush();
ostream& put(char c) { _strbuf->sputc(c); return *this; }
ostream& write(const char *s, streamsize n);
ostream& write(const unsigned char *s, streamsize n)
{ return write((const char*)s, n);}
ostream& write(const signed char *s, streamsize n)
{ return write((const char*)s, n);}
ostream& write(const void *s, streamsize n)
{ return write((const char*)s, n);}
ostream& seekp(streampos);
ostream& seekp(streamoff, _seek_dir);
streampos tellp();
ostream& form(const char *format ...);
ostream& vform(const char *format, __gnuc_va_list args);
ostream& operator<<(char c);
ostream& operator<<(unsigned char c) { return (*this) << (char)c; }
ostream& operator<<(signed char c) { return (*this) << (char)c; }
ostream& operator<<(const char *s);
ostream& operator<<(const unsigned char *s)
{ return (*this) << (const char*)s; }
ostream& operator<<(const signed char *s)
{ return (*this) << (const char*)s; }
ostream& operator<<(const void *p);
ostream& operator<<(int n);
ostream& operator<<(unsigned int n);
ostream& operator<<(long n);
ostream& operator<<(unsigned long n);
__extension__ ostream& operator<<(long long n);
__extension__ ostream& operator<<(unsigned long long n);
ostream& operator<<(short n) {return operator<<((int)n);}
ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);}
ostream& operator<<(bool b) { return operator<<((int)b); }
ostream& operator<<(double n);
ostream& operator<<(float n) { return operator<<((double)n); }
ostream& operator<<(long double n);
ostream& operator<<(__omanip func) { return (*func)(*this); }
ostream& operator<<(__manip func) {(*func)(*this); return *this;}
ostream& operator<<(streambuf*);
};
class istream : virtual public ios
{
protected:
size_t _gcount;
int _skip_ws();
public:
istream(): _gcount (0) { }
istream(streambuf* sb, ostream*tied= __null );
istream& get(char* ptr, int len, char delim = '\n');
istream& get(unsigned char* ptr, int len, char delim = '\n')
{ return get((char*)ptr, len, delim); }
istream& get(char& c);
istream& get(unsigned char& c) { return get((char&)c); }
istream& getline(char* ptr, int len, char delim = '\n');
istream& getline(unsigned char* ptr, int len, char delim = '\n')
{ return getline((char*)ptr, len, delim); }
istream& get(signed char& c) { return get((char&)c); }
istream& get(signed char* ptr, int len, char delim = '\n')
{ return get((char*)ptr, len, delim); }
istream& getline(signed char* ptr, int len, char delim = '\n')
{ return getline((char*)ptr, len, delim); }
istream& read(char *ptr, streamsize n);
istream& read(unsigned char *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& read(signed char *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& read(void *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& get(streambuf& sb, char delim = '\n');
istream& gets(char **s, char delim = '\n');
int ipfx(int need = 0) {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
if (!need && (flags() & ios::skipws)) return _skip_ws();
else return 1;
}
}
int ipfx0() {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie) _tie->flush();
if (flags() & ios::skipws) return _skip_ws();
else return 1;
}
}
int ipfx1() {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
return 1;
}
}
void isfx() { ; }
int get() { if (!ipfx1()) return (-1) ;
else { int ch = _strbuf->sbumpc();
if (ch == (-1) ) set(ios::eofbit);
isfx();
return ch;
} }
int peek();
size_t gcount() { return _gcount; }
istream& ignore(int n=1, int delim = (-1) );
int sync ();
istream& seekg(streampos);
istream& seekg(streamoff, _seek_dir);
streampos tellg();
istream& putback(char ch) {
if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
return *this;}
istream& unget() {
if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
return *this;}
istream& scan(const char *format ...);
istream& vscan(const char *format, __gnuc_va_list args);
istream& operator>>(char*);
istream& operator>>(unsigned char* p) { return operator>>((char*)p); }
istream& operator>>(signed char*p) { return operator>>((char*)p); }
istream& operator>>(char& c);
istream& operator>>(unsigned char& c) {return operator>>((char&)c);}
istream& operator>>(signed char& c) {return operator>>((char&)c);}
istream& operator>>(int&);
istream& operator>>(long&);
__extension__ istream& operator>>(long long&);
__extension__ istream& operator>>(unsigned long long&);
istream& operator>>(short&);
istream& operator>>(unsigned int&);
istream& operator>>(unsigned long&);
istream& operator>>(unsigned short&);
istream& operator>>(bool&);
istream& operator>>(float&);
istream& operator>>(double&);
istream& operator>>(long double&);
istream& operator>>( __manip func) {(*func)(*this); return *this;}
istream& operator>>(__imanip func) { return (*func)(*this); }
istream& operator>>(streambuf*);
};
class iostream : public istream, public ostream
{
public:
iostream() { }
iostream(streambuf* sb, ostream*tied= __null );
};
class _IO_istream_withassign : public istream {
public:
_IO_istream_withassign& operator=(istream&);
_IO_istream_withassign& operator=(_IO_istream_withassign& rhs)
{ return operator= (static_cast<istream&> (rhs)); }
};
class _IO_ostream_withassign : public ostream {
public:
_IO_ostream_withassign& operator=(ostream&);
_IO_ostream_withassign& operator=(_IO_ostream_withassign& rhs)
{ return operator= (static_cast<ostream&> (rhs)); }
};
extern _IO_istream_withassign cin;
extern _IO_ostream_withassign cout, cerr;
extern _IO_ostream_withassign clog
;
extern istream& lock(istream& ins);
extern istream& unlock(istream& ins);
extern ostream& lock(ostream& outs);
extern ostream& unlock(ostream& outs);
struct Iostream_init { } ;
inline ios& dec(ios& i)
{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
inline ios& hex(ios& i)
{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
inline ios& oct(ios& i)
{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }
}
# 6 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/iostream" 2 3
# 1 "weird_problem.cc" 2
# 1 "checkedptr.h" 1
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/cctype" 1 3
# 1 "/usr/include/ctype.h" 1 3
extern "C" {
# 1 "/usr/include/endian.h" 1 3
# 1 "/usr/include/bits/endian.h" 1 3
# 35 "/usr/include/endian.h" 2 3
# 40 "/usr/include/ctype.h" 2 3
enum
{
_ISupper = (( 0 ) < 8 ? ((1 << ( 0 )) << 8) : ((1 << ( 0 )) >> 8)) ,
_ISlower = (( 1 ) < 8 ? ((1 << ( 1 )) << 8) : ((1 << ( 1 )) >> 8)) ,
_ISalpha = (( 2 ) < 8 ? ((1 << ( 2 )) << 8) : ((1 << ( 2 )) >> 8)) ,
_ISdigit = (( 3 ) < 8 ? ((1 << ( 3 )) << 8) : ((1 << ( 3 )) >> 8)) ,
_ISxdigit = (( 4 ) < 8 ? ((1 << ( 4 )) << 8) : ((1 << ( 4 )) >> 8)) ,
_ISspace = (( 5 ) < 8 ? ((1 << ( 5 )) << 8) : ((1 << ( 5 )) >> 8)) ,
_ISprint = (( 6 ) < 8 ? ((1 << ( 6 )) << 8) : ((1 << ( 6 )) >> 8)) ,
_ISgraph = (( 7 ) < 8 ? ((1 << ( 7 )) << 8) : ((1 << ( 7 )) >> 8)) ,
_ISblank = (( 8 ) < 8 ? ((1 << ( 8 )) << 8) : ((1 << ( 8 )) >> 8)) ,
_IScntrl = (( 9 ) < 8 ? ((1 << ( 9 )) << 8) : ((1 << ( 9 )) >> 8)) ,
_ISpunct = (( 10 ) < 8 ? ((1 << ( 10 )) << 8) : ((1 << ( 10 )) >> 8)) ,
_ISalnum = (( 11 ) < 8 ? ((1 << ( 11 )) << 8) : ((1 << ( 11 )) >> 8))
};
extern __const unsigned short int *__ctype_b;
extern __const __int32_t *__ctype_tolower;
extern __const __int32_t *__ctype_toupper;
extern int isalnum (int) throw () ;
extern int isalpha (int) throw () ;
extern int iscntrl (int) throw () ;
extern int isdigit (int) throw () ;
extern int islower (int) throw () ;
extern int isgraph (int) throw () ;
extern int isprint (int) throw () ;
extern int ispunct (int) throw () ;
extern int isspace (int) throw () ;
extern int isupper (int) throw () ;
extern int isxdigit (int) throw () ;
extern int tolower (int __c) throw () ;
extern int toupper (int __c) throw () ;
extern int isascii (int __c) throw () ;
extern int toascii (int __c) throw () ;
extern int _toupper (int) throw () ;
extern int _tolower (int) throw () ;
# 164 "/usr/include/ctype.h" 3
# 186 "/usr/include/ctype.h" 3
# 273 "/usr/include/ctype.h" 3
}
# 6 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/../../../../include/g++-3/cctype" 2 3
# 4 "checkedptr.h" 2
# 1 "/usr/include/assert.h" 1 3
# 32 "/usr/include/assert.h" 3
# 56 "/usr/include/assert.h" 3
extern "C" {
extern void __assert_fail (__const char *__assertion,
__const char *__file,
unsigned int __line,
__const char *__function) throw ()
__attribute__ ((__noreturn__));
extern void __assert_perror_fail (int __errnum,
__const char *__file,
unsigned int __line,
__const char *__function) throw ()
__attribute__ ((__noreturn__));
}
# 5 "checkedptr.h" 2
# 1 "/usr/include/string.h" 1 3
extern "C" {
# 1 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 1 3
# 19 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 61 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 131 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 188 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 271 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 283 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 317 "/usr/lib/gcc-lib/i586-mandrake-linux/2.95.2/include/stddef.h" 3
# 33 "/usr/include/string.h" 2 3
extern void * memcpy (void * __restrict __dest,
__const void * __restrict __src, size_t __n) throw () ;
extern void * memmove (void * __dest, __const void * __src,
size_t __n) throw () ;
extern void * memccpy (void * __dest, __const void * __src,
int __c, size_t __n) throw () ;
extern void * memset (void * __s, int __c, size_t __n) throw () ;
extern int memcmp (__const void * __s1, __const void * __s2,
size_t __n) throw () ;
extern void * memchr (__const void * __s, int __c, size_t __n) throw () ;
extern char *strcpy (char *__restrict __dest,
__const char *__restrict __src) throw () ;
extern char *strncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) throw () ;
extern char *strcat (char *__restrict __dest,
__const char *__restrict __src) throw () ;
extern char *strncat (char *__restrict __dest,
__const char *__restrict __src, size_t __n) throw () ;
extern int strcmp (__const char *__s1, __const char *__s2) throw () ;
extern int strncmp (__const char *__s1, __const char *__s2, size_t __n) throw () ;
extern int strcoll (__const char *__s1, __const char *__s2) throw () ;
extern size_t strxfrm (char *__restrict __dest,
__const char *__restrict __src, size_t __n) throw () ;
# 107 "/usr/include/string.h" 3
extern char *__strdup (__const char *__s) throw () ;
extern char *strdup (__const char *__s) throw () ;
# 143 "/usr/include/string.h" 3
extern char *strchr (__const char *__s, int __c) throw () ;
extern char *strrchr (__const char *__s, int __c) throw () ;
extern size_t strcspn (__const char *__s, __const char *__reject) throw () ;
extern size_t strspn (__const char *__s, __const char *__accept) throw () ;
extern char *strpbrk (__const char *__s, __const char *__accept) throw () ;
extern char *strstr (__const char *__haystack, __const char *__needle) throw () ;
extern char *strtok (char *__restrict __s,
__const char *__restrict __delim) throw () ;
extern char *__strtok_r (char *__restrict __s,
__const char *__restrict __delim,
char **__restrict __save_ptr) throw () ;
extern char *strtok_r (char *__restrict __s,
__const char *__restrict __delim,
char **__restrict __save_ptr) throw () ;
# 203 "/usr/include/string.h" 3
extern size_t strlen (__const char *__s) throw () ;
extern char *strerror (int __errnum) throw () ;
extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen) throw () ;
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) throw () ;
extern void __bzero (void * __s, size_t __n) throw () ;
extern void bcopy (__const void * __src, void * __dest, size_t __n) throw () ;
extern void bzero (void * __s, size_t __n) throw () ;
extern int bcmp (__const void * __s1, __const void * __s2, size_t __n) throw () ;
extern char *index (__const char *__s, int __c) throw () ;
extern char *rindex (__const char *__s, int __c) throw () ;
extern int __ffs (int __i) throw () __attribute__ ((const));
extern int ffs (int __i) throw () __attribute__ ((const));
extern int __strcasecmp (__const char *__s1, __const char *__s2) throw () ;
extern int strcasecmp (__const char *__s1, __const char *__s2) throw () ;
extern int strncasecmp (__const char *__s1, __const char *__s2,
size_t __n) throw () ;
# 277 "/usr/include/string.h" 3
extern char *strsep (char **__restrict __stringp,
__const char *__restrict __delim) throw () ;
# 319 "/usr/include/string.h" 3
# 347 "/usr/include/string.h" 3
}
# 6 "checkedptr.h" 2
typedef enum { LAX=0, STRICT=1 } PtrBound;
template <class T, PtrBound bound=STRICT> struct Ptr
{
private:
T* m_p;
T* m_s;
size_t m_c;
bool m_array;
static const T* const UNASSIGNED = (const T*) 0xFFFFFFFF;
static const T* const OUTOFSCOPE = (const T*) 0xFFFFFFFD;
void assert_sanity() const
{
((void) (( m_p != (T*) OUTOFSCOPE ) ? 0 : (__assert_fail ("m_p != (T*) OUTOFSCOPE" , "checkedptr.h", 26, __PRETTY_FUNCTION__ ), 0))) ;
((void) (( m_s != (T*) OUTOFSCOPE ) ? 0 : (__assert_fail ("m_s != (T*) OUTOFSCOPE" , "checkedptr.h", 27, __PRETTY_FUNCTION__ ), 0))) ;
if (m_p && (m_p != (T*) UNASSIGNED))
{
((void) (( m_s != 0 ) ? 0 : (__assert_fail ("m_s != 0" , "checkedptr.h", 31, __PRETTY_FUNCTION__ ), 0))) ;
((void) (( m_c > 0 ) ? 0 : (__assert_fail ("m_c > 0" , "checkedptr.h", 32, __PRETTY_FUNCTION__ ), 0))) ;
((void) (( m_s != (T*) UNASSIGNED ) ? 0 : (__assert_fail ("m_s != (T*) UNASSIGNED" , "checkedptr.h", 33, __PRETTY_FUNCTION__ ), 0))) ;
}
}
public:
Ptr() throw ()
: m_p((T*)UNASSIGNED), m_s((T*)UNASSIGNED), m_c(0), m_array(false)
{
}
Ptr(T* p, T* start, size_t count, bool array) throw ()
: m_p(p)
, m_s(start), m_c(count), m_array(array)
{
assert_sanity();
}
Ptr(T* p, size_t count, bool array = true) throw ()
: m_p(p)
, m_s(p), m_c(count), m_array(array)
{
assert_sanity();
}
Ptr(T* p) throw ()
: m_p(p)
, m_s(p), m_c(1), m_array(false)
{
assert_sanity();
}
Ptr(const Ptr<T>& p) throw ()
: m_p(p.m_p)
, m_s(p.m_s), m_c(p.m_c), m_array(p.m_array)
{
assert_sanity();
}
~Ptr() throw ()
{
assert_sanity();
m_p = (T*) OUTOFSCOPE;
m_s = (T*) OUTOFSCOPE;
}
Ptr& operator=(T* p) throw ()
{
m_p = p;
if (p != 0)
{
m_s = p;
m_c = 1;
}
else
{
m_s = (T *) 0xDEADBEEF;
m_c = 0;
}
assert_sanity();
return *this;
}
Ptr& assign(T* p, T* start, size_t count, bool array = (count>1)) throw ()
{
m_p = p;
m_s = start;
m_c = count;
m_array = array;
assert_sanity();
return *this;
}
Ptr& assign(T* p, size_t count) throw ()
{
m_p = p;
m_s = p;
m_c = count;
m_array = true;
assert_sanity();
return *this;
}
Ptr& operator=(const Ptr<T>& p) throw ()
{
p.assert_sanity();
m_p = p.m_p;
m_s = p.m_s;
m_c = p.m_c;
m_array = p.m_array;
return *this;
}
int operator-(const Ptr<T>& p) const throw()
{
bc(p.m_p);
return m_p - p.m_p;
}
int operator-(T* p) const throw()
{
bc(p);
return m_p - p;
}
Ptr operator+(int n) const throw()
{
if (bound == STRICT)
bc2(m_p + n);
else
assert_sanity();
return Ptr(m_p+n, m_s, m_c, m_array);
}
Ptr& operator+=(int n) throw()
{
if (bound == STRICT)
bc2(m_p + n);
else
assert_sanity();
m_p += n;
return *this;
}
Ptr& operator++() throw()
{
if (bound == STRICT)
bc2(m_p+1);
else
assert_sanity();
++m_p;
return *this;
}
Ptr operator++(int) throw()
{
if (bound == STRICT)
bc2(m_p+1);
else
assert_sanity();
Ptr temp(*this);
++m_p;
return temp;
}
Ptr operator-(int n) const throw()
{
if (bound == STRICT)
bc(m_p - n);
else
assert_sanity();
return Ptr(m_p-n, m_s, m_c);
}
Ptr& operator--() throw()
{
if (bound == STRICT)
bc(m_p-1);
else
assert_sanity();
--m_p;
return *this;
}
Ptr operator--(int) throw()
{
if (bound == STRICT)
bc(m_p-1);
else
assert_sanity();
Ptr temp(*this);
--m_p;
return temp;
}
T& operator[](int i) const throw()
{
bc(m_p + i);
return m_p[i];
}
T* operator->() const throw() { bc(m_p); return m_p; }
T& operator*() const throw() { bc(m_p); return *m_p; }
operator bool() const throw()
{
assert_sanity();
return m_p != 0;
}
T* ptr() const throw() { bc(m_p); return m_p; }
template<class T2> operator Ptr<T2, bound>() const throw()
{
assert_sanity();
return Ptr<T2>(m_p, m_s, m_c, m_array);
}
size_t getCount() const { return m_c; }
private:
void bc(const T* p) const throw()
{
((void) (( m_p != 0 ) ? 0 : (__assert_fail ("m_p != 0" , "checkedptr.h", 294, __PRETTY_FUNCTION__ ), 0))) ;
((void) (( m_p != (T*) UNASSIGNED ) ? 0 : (__assert_fail ("m_p != (T*) UNASSIGNED" , "checkedptr.h", 295, __PRETTY_FUNCTION__ ), 0))) ;
assert_sanity();
((void) (( (p >= m_s) && (p < &m_s[m_c]) ) ? 0 : (__assert_fail ("(p >= m_s) && (p < &m_s[m_c])" , "checkedptr.h", 298, __PRETTY_FUNCTION__ ), 0))) ;
}
void bc2(const T* p) const throw()
{
((void) (( m_p != 0 ) ? 0 : (__assert_fail ("m_p != 0" , "checkedptr.h", 303, __PRETTY_FUNCTION__ ), 0))) ;
((void) (( m_p != (T*) UNASSIGNED ) ? 0 : (__assert_fail ("m_p != (T*) UNASSIGNED" , "checkedptr.h", 304, __PRETTY_FUNCTION__ ), 0))) ;
assert_sanity();
((void) (( (p >= m_s) && (p <= &m_s[m_c]) ) ? 0 : (__assert_fail ("(p >= m_s) && (p <= &m_s[m_c])" , "checkedptr.h", 307, __PRETTY_FUNCTION__ ), 0))) ;
}
friend void delete_array<T>(Ptr<T> p);
friend void delete1<T>(Ptr<T> p);
};
template <class T2>
template <class T>
Ptr<T> cast(Ptr<T2> p)
{
return static_cast<T> (p.ptr());
}
template <class T>
inline Ptr<T> new_array(size_t num)
{
return Ptr<T> (new T[num], num);
}
template <class T>
void delete1(Ptr<T> p)
{
p.bc(p.m_p);
((void) (( !p.m_array ) ? 0 : (__assert_fail ("!p.m_array" , "checkedptr.h", 333, __PRETTY_FUNCTION__ ), 0))) ;
T* ptr = p.m_p;
p.m_p = Ptr<T>::UNASSIGNED;
delete ptr;
}
template <class T>
void delete_array(Ptr<T> p)
{
p.bc(p.m_p);
((void) (( p.m_array ) ? 0 : (__assert_fail ("p.m_array" , "checkedptr.h", 348, __PRETTY_FUNCTION__ ), 0))) ;
T* ptr = p.m_p;
p.m_p = Ptr<T>::UNASSIGNED;
delete[] ptr;
}
template <class T1, class T2>
inline void safe_memmove(Ptr<T1> to, Ptr<const T2> from, size_t s)
{
_safe_memmove(Ptr<char> (reinterpret_cast<char*>(to.ptr()), sizeof(T1)*to.getCount()),
Ptr<const char> (reinterpret_cast<const char*>(from.ptr()), sizeof(T2)*from.getCount()),
s);
}
inline void _safe_memmove(Ptr<char> to, Ptr<const char> from, size_t s)
{
to[0] = from[0];
if (s > 1)
to[s-1] = from[s-1];
if (s > 2)
memmove((to+1).ptr(), (from+1).ptr(), s-2);
}
template <class T>
inline void safe_memset(Ptr<T> to, int val, size_t s)
{
_safe_memset(Ptr<char> (reinterpret_cast<char*>(to.ptr()), sizeof(T)*to.getCount()), val, s);
}
inline void _safe_memset(Ptr<char> to, int val, size_t s)
{
to[0] = (char) val;
if (s > 1)
to[s-1] = (char) val;
if (s > 2)
memset((to+1).ptr(), val, s-2);
}
# 3 "weird_problem.cc" 2
struct NE
{
NE() : n(12) { };
int n;
};
struct A : public NE
{
A() : a(34) { };
int a;
};
struct T : public NE
{
T() : t(56) { };
int t;
};
void pne(Ptr<NE> n)
{
cout << "n=" << n->n << endl;
}
void pne(Ptr<T> t)
{
cout << "t=" << t->t << endl;
}
int main(int argc, char* argv[])
{
Ptr<A> q = new A();
pne(cast<NE>(q));
return 0;
}