www.digitalmars.com         C & C++   DMDScript  

c++ - Internal error: token 879

reply mx0 seznam.cz writes:
Hello,

can please someone tell me what is meaning of error code "Internal error: token
879"?

It comes if I use precompiled headers in dmc (v8.42), and only in release build
(meaning without -g -D, with or without optimization [no difference, always the
same error]) - the same code compiled without using precompiled headers (debug
and release, the same flags as when precompiled headers used) or with
precompiled headers in debug mode, compiles fine without any error or warning.

I found the place where it comes:

in class member function (nonstatic, virtual, in abstract class) there is line:

myStringArray::ConstIterator iter;

- with this line commented out, it compiles without any error; and this line
compiles fine if not using precompiled headers / or using precompiled headers in
debug mode (-g -D the only difference). But in release mode with precompiled
headers it fails.

in headers (are precompiled) there is following code (simplified):

class myStringArray: public myVector< myString > {
..
};

(myString is class)

and

template< class ValueType >
class myIterator {
..
private:
ValueType * m_pObject;
};

template< class Type >
class myVector{
..
public:
typedef Type                ValueType;
typedef myIterator< ValueType >         Iterator;
typedef myIterator< const ValueType >   ConstIterator;
..
};

and even declaration

myVector< myString >::ConstIterator iter;

or

myVector< myString >::Iterator iter;
or
myStringArray::Iterator iter;

did not help, always giving the error "Internal error: token 879".

I know that it is probably non easy task using precompiled headers with class
templates, and I can switch precompiled headers out (dmc is anyway one of the
fastest compilers I know, with reasonably correct c++ support), but it seems to
me strange that it comes only in release build and not in debug build.
Jun 13 2005
parent reply "Walter" <newshound digitalmars.com> writes:
<mx0 seznam.cz> wrote in message news:d8k6et$1stu$1 digitaldaemon.com...
 can please someone tell me what is meaning of error code "Internal error:

 879"?

The only way this can be fixed is if you can find a reproducible example, whittle it down to the smallest size, and send it in. Thanks, -Walter
Jun 13 2005
parent reply mx0 seznam.cz writes:
In article <d8lk0u$1c8$2 digitaldaemon.com>, Walter says...
The only way this can be fixed is if you can find a reproducible example,
whittle it down to the smallest size, and send it in.

Thanks,
-Walter

I've build small example; when I tried to cut down the unnecessary code, I have found that the problem has nothing to do with classes, but probably with template expansion. I've attached the zipped example which gives the error, see "ErrOut.txt" in the zip for my output. The sample compiles fine without using precompiled headers, but when trying to compile *.cpp using precompiled header, compilation fails with the strange error message. More strange is, that if I delete one 'x' from the string in PCHtest.hpp template< class ValueType > void TempFunc( void ) { printf( "Some message. xxxxx xxxxxx xxxxx xxxxx xxxx xxxxxx" ); } the sample is compiled fine even using precompiled headers! It seems the problem is related to the string length when using inside template and using precompiled headers. If the function is not declared and used as template (only as regular function), even with longer string, it compiles fine even using precompield headers. Sumarization ... the sample compiles fine in following cases (OR): - the string in the function template is 1 char shorter - the function is declared and used as normal function, not template - precompiled headers not used.
Jun 14 2005
parent "Walter" <newshound digitalmars.com> writes:
Thanks! I can take it from here. -Walter
Jun 14 2005