[build2] GCC 10: error: invalid initialization of reference from expression of type '<brace-enclosed initializer list>'

Boris Kolpackov boris at codesynthesis.com
Fri Feb 7 14:10:52 UTC 2020


Matthew Krupcale <mkrupcale at matthewkrupcale.com> writes:

> error: invalid initialization of reference of type 'const
> build2::target_type&' from expression of type '<brace-enclosed
> initializer list>'
>   837 | const target_type& pdb (bs.derive_target_type<file> ("pdb").first);
>
> I think this might be because it's doing parenthesized initialization
> of an aggregate with a single argument[5], which appears to be
> unsupported by GCC 10 at the moment[6]. I don't think this should
> require changes on the part of build2, so hopefully GCC is able to
> resolve this issue soon and Fedora picks it up for F32.

I am pretty sure this is a GCC bug. It is initializing a const reference
from a reference_wrapper<> expression.


> PS: It also looks like std::is_pod is deprecated in C++20:
> 
> /builddir/build/BUILD/build2-toolchain-0.12.0/build2-0.12.0/libbuild2/function.hxx:144:27:
> warning: 'template<class _Tp> struct std::is_pod' is deprecated: use
> is_standard_layout && is_trivial instead [-Wdeprecated-declarations]
>   144 |       static_assert (std::is_pod<D>::value, "type is not POD");

Thanks, will look into this. At some point we will add a GCC 10 build
machine to our CI and clean all this up. But I don't think things are
stable enough just yet.


> PPS: Is it not possible to build/update dynamically created targets
> (like obj{})?

Unfortunately this doesn't work as one may expect. The dynamic
creation of targets like obj{} happens during a rule matching for
targets like exe{} or lib{}. But if you are not building one of
those exe{} or lib{}, then those rules are not matched and obj{}
are not created.

I am not yet sure what, if anything, we can do about this. In a
sense, it's trying to eat a cake (by not having to explicitly spell
obj{}:cxx{} dependencies) and having it too (by being able to refer
to these obj{}).



More information about the users mailing list