[Interest] error: taking address of temporary [-fpermissive]

Konstantin Tokarev annulen at yandex.ru
Fri Jun 1 18:51:54 CEST 2012



01.06.2012, 20:34, "Nikos Chantziaras" <realnc at gmail.com>:
> On 01/06/12 19:11, Robert Wood wrote:
>
>>  Folks,
>>
>>  I have just upgraded to Mageia Linux 2 and am now getting this compile
>>  error:
>>
>>  error: taking address of temporary [-fpermissive]
>>
>>  This was previously compiling just fine.
>>
>>  I'm now running Creator 2.4.1 Based on Qt 4.8.0.
>>
>>  Anyone know what is going on please?
>
> You are doing this:
>
>    class A;
>    void foo(A*);
>    ...
>    foo(&A());
>
> (Or something very similar.)
>
> Which is wrong.  The compiler is correct; it's an error :-)

GCC >= 4.6 treats it as error. That also won't compile with clang (of any version I've used).

-- 
Regards,
Konstantin



More information about the Interest mailing list