Project

General

Profile

Necessary Maintenance #19474

Workaround for Clang bug on array initialisation

Added by Gianluca Petrillo over 1 year ago. Updated over 1 year ago.

Status:
Accepted
Priority:
Normal
Assignee:
-
Category:
Other
Target version:
-
Start date:
03/23/2018
Due date:
% Done:

0%

Estimated time:
Experiment:
-
Duration:

Description

Clang 5.0 complains that elements should be enclosed in braces during array initialisation.
The error message looks like:

srcs/larcorealg/test/Geometry/GeometryTestAlg.cxx:2044:9: error: suggest braces around initialization of subobject
      [-Werror,-Wmissing-braces]
      { IncreasingWireDir.X(), IncreasingWireDir.Y(), IncreasingWireDir.Z() };
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        {                                                                  }

This is acknowledges as Clang bug 21629.
The workaround we have set in place is to enclose the whole list of initialisers in a further level of braces, e.g. std::array<int, 3> a = {{ 1, 2, 3 }};.
We have also decorated everywhere this workaround with:
  // BUG the double brace syntax is required to work around clang bug 21629
  // (https://bugs.llvm.org/show_bug.cgi?id=21629)

When the upstream bug is fixed (Clang 6, apparently), we should remove the workaround.

Associated revisions

Revision 09c0dad8 (diff)
Added by Gianluca Petrillo over 1 year ago

Workaround for array initialisation bug, issue #19474

Revision 7f67ee0d (diff)
Added by Gianluca Petrillo over 1 year ago

Workaround for array initialisation bug, issue #19474

Revision ef2a0542 (diff)
Added by Gianluca Petrillo over 1 year ago

Workaround for array initialisation bug, issue #19474

Revision cf6c610b (diff)
Added by Gianluca Petrillo over 1 year ago

Workaround for array initialisation bug, issue #19474

Revision 3fd47ea7 (diff)
Added by Lynn Garren over 1 year ago

Workaround for array initialisation bug, issue #19474

History

#1 Updated by Lynn Garren over 1 year ago

  • Status changed from New to Accepted


Also available in: Atom PDF