Date: Sat, 19 Oct 2024 22:58:56 -0700
On Saturday 19 October 2024 12:59:31 GMT-7 Federico Kircheis via Std-
Discussion wrote:
> As an example, a class that logs in the destructor it's address and a
> string:
>
> https://godbolt.org/z/sb8n8fn1a
This one has a ODR violation: the symbol "instance" is defined in two TUs. It's
ill-formed.
> Same class, slightly different context:
>
> https://godbolt.org/z/Thv8xhc6Y
Also ODR violation for the same reason.
> Another example that shows the same behavior
>
> https://godbolt.org/z/ecPPq8vns
This is the exact same code as the previous one: lib0.cpp is linked twice into
your executable, therefore ODR violation.
Discussion wrote:
> As an example, a class that logs in the destructor it's address and a
> string:
>
> https://godbolt.org/z/sb8n8fn1a
This one has a ODR violation: the symbol "instance" is defined in two TUs. It's
ill-formed.
> Same class, slightly different context:
>
> https://godbolt.org/z/Thv8xhc6Y
Also ODR violation for the same reason.
> Another example that shows the same behavior
>
> https://godbolt.org/z/ecPPq8vns
This is the exact same code as the previous one: lib0.cpp is linked twice into
your executable, therefore ODR violation.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Platform & System Engineering
Received on 2024-10-20 05:58:58