[squid-dev] [PATCH] Compilation error after r15057

Alex Rousskov rousskov at measurement-factory.com
Mon Feb 20 18:06:14 UTC 2017


On 02/20/2017 07:58 AM, Eduard Bagdasaryan wrote:

> Attaching compilation fix for r15057.

Committed to v5 (r15061).


> src/client_db.cc:443:21: error: 'reinterpret_cast' to class 'ClientInfo *' from its base at non-zero offset 'hash_link *' behaves differently from 'static_cast' [-Werror,-Wreinterpret-base-class]
>     ClientInfo *c = reinterpret_cast<ClientInfo *>(hash_next(client_table));

I am not sure why clang claims that hash_link offset inside ClientInfo
is not zero despite the fact that hash_link is the first ClientInfo
parent, but I suspect that this is because hash_link is a POD while
ClientInfo sometimes has a vtable that a compiler may place at offset
zero of a ClientInfo object, shifting hash_link data members down.

> class ClientInfo : public hash_link
> #if USE_DELAY_POOLS
>     , public BandwidthBucket
> #endif
> {


Thank you,

Alex.



More information about the squid-dev mailing list