Compile error when not using -ftree-ter

Job Noorman jobnoorman@gmail.com
Sun Aug 15 20:43:00 GMT 2010


Hi,

Consider the following code snippet:

    struct Foo
    {
        void foobar() {}
    };

    typedef void (*plain_foobar_t)(Foo*);

    void test()
    {
        asm("push %0;"
            :
            : "i"((plain_foobar_t)&Foo::foobar));
    }

    int main(){}

If I compile this with

    g++ -Wno-pmf-conversions main.cpp

I get the following;

    main.cpp: In function ‘void test()’:
    main.cpp:12: warning: asm operand 0 probably doesn’t match constraints
    main.cpp:12: error: impossible constraint in ‘asm’

However, if I compile it with

    g++ -Wno-pmf-conversions -ftree-ter main.cpp

all is fine.

Should I file a bug about this or is this somehow wanted behavior? If so, could 
anybody explain what the problem is?

Thanks in advance,
Job



More information about the Gcc-help mailing list