Problem compiling libstdc++ is current 4.0.2 cvs (volatile strikes again)
Kean Johnston
jkj@sco.com
Mon Jul 25 06:49:00 GMT 2005
> The error makes perfect sense. __pthread_mutex has only one
> assignment operator for it (implicitly generated by the compiler):
> __pthread_mutex & operator=(const __pthread_mutex&).
> When you try to pass a volatile __pthread_mutex (named as
> pthread_mutex_t), the compiler can't pass it to the assignment
> operator - because then `volatile' would be stripped off the
> reference.
>
> I have created a small test case to demonstrate this:
> typedef volatile struct A{} Av;
> void foo()
> {
> Av x;
> x = Av();
> }
>
> This test gives an error with any compiler I could tested it with:
> gcc-2.96, gcc-3.2.1, gcc-4.0.0, xlC-6.0.0
Interestingly enough, it gives an error with the native
compiler too (based on teh EDG front-end).
To fix this for GCC, I will fixincludes the volatile away.
> Do you know why the type itself is defined as volatile, as opposed to
I don't, but I shall ask the person who wrote the header file.
> declaring only relevant variables as volatile? What system is it anyway?
System V Release 5 (UnixWare / OpenServer 6).
Kean
More information about the Gcc
mailing list