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

Matthew Krupcale mkrupcale at matthewkrupcale.com
Thu Feb 6 19:41:41 UTC 2020


Hello,

Fedora 32 will ship with GCC 10[1], and as part of that update, a mass
rebuild of packages is done[2]. build2 and bpkg though failed to
compile[3] due to several new errors[4] like:

/builddir/build/BUILD/build2-toolchain-0.12.0/build2-0.12.0/libbuild2/bin/init.cxx:
In function 'bool build2::bin::ld_init(build2::scope&, build2::scope&,
const build2::location&, std::unique_ptr<build2::module_base>&, bool,
bool, const build2::variable_map&)':
/builddir/build/BUILD/build2-toolchain-0.12.0/build2-0.12.0/libbuild2/bin/init.cxx:837:74:
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.

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");

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

# b --verbose 6 build2-0.12.0/libbuild2/libs{build2} |& grep 'obj{dump}'
trace: create_new_target: new target
/builddir/build/BUILD/build2-toolchain-0.12.0/build2-0.12.0/libbuild2/obj{dump}
for prerequisite
/builddir/build/BUILD/build2-toolchain-0.12.0/build2-0.12.0/libbuild2/:obj{dump}
# b build2-0.12.0/libbuild2/obj{dump}
<buildspec>: error: unknown target build2-0.12.0/libbuild2/obj{dump}
in build2-0.12.0/libbuild2/buildfile

Best,
Matthew

[1] https://fedoraproject.org/wiki/Changes/GCC10
[2] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/MZULCOMKMKXROVDSRKOXD4JY342GKBOH/
[3] https://koji.fedoraproject.org/koji/taskinfo?taskID=41316053
[4] https://kojipkgs.fedoraproject.org//work/tasks/6351/41316351/build.log
[5] https://wg21.link/p1975r0
[6] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92812



More information about the users mailing list