]> www.ginac.de Git - ginac.git/commit
Avoid 'variable uninitialized when used within its own initialization' warning.
authorRichard Kreckel <kreckel@ginac.de>
Sun, 22 Nov 2020 20:40:58 +0000 (21:40 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Sun, 22 Nov 2020 21:22:34 +0000 (22:22 +0100)
commitbb25688f05cde1e8ba3c0e83cf4d3554087ad595
tree53fdcfff5efe405967d8b3670397c194f1bb1021
parent0ba4e319079c68d97bb307f6e8c8779eea7f4131
Avoid 'variable uninitialized when used within its own initialization' warning.

Initialize the static flyweight ex objects with the pointeed numeric
objects instead of using self-assignment. This is 100% equivalent to
before: The objects have already been initialized by the library_init
ctor so all the static object's ctor does is increment the pointeed
object's refcount.

According to the resolution of C++ core language defect 363 the warning is
incorrect because it is allowed to pass a reference to the object, see
<https://wg21.link/cwg363>. Incrementing the bp's refcount is okay too,
because the pointee numeric object has been fully initialized by the
library_init ctor. However, the compiler can hardly know this, so CLang++
issues a warning.
ginac/utils.cpp