I'm new to gcc, and I'm encountering a really strange problem while compiling precompiled header in gcc-4.7.2/4.7.3.
The codes below:
FooClass.h
#include <cstddef>
#include <X11/X.h>
#include <xmmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
#ifndef FOO_CLASS_ERROR
#define FOO_CLASS_ERROR
class FooClass
{
public:
    union
    {
        struct
        {
            float x,y,z,w;
        };
        __m128 v;
    };
    FooClass( void )
    {
    }
    FooClass( const __m128 _v )
    : v( _v )
    {
    }
    FooClass( const FooClass& rhs )
    : v( rhs.v )
    {
    }
    FooClass operator -( void ) const;
} __attribute__( (aligned(16)) );
#endif
FooClass.cpp
#include "FooClass.h"
FooClass FooClass::operator -( void ) const
{
    return FooClass();
}
compiled as pch:
g++ -Wall -fexceptions -g -msse4.1 -Winvalid-pch -include "FooClass.h"  -c FooClass.h -o FooClass.h.gch
g++ -Wall -fexceptions -g -msse4.1 -Winvalid-pch -include "FooClass.h"  -c FooClass.cpp -o obj/Debug/FooClass.o
will generate errors:
./pch.h:40:17: error: prototype for ‘FooClass FooClass::operator-() const’ does not match any in class ‘FooClass’
./pch.h:36:14: error: candidate is: FooClass FooClass::operator-() const
I've checked for a whole afternoon, and found that:
Removing "const" or the copy constructor will solved these errors.
But I don't know why...Can somebody tell me the reason that causes this error? or maybe it's a gcc bug?
 
    