PointND constructor usage with initialiser list
I have an issue with constructing points using an initialiser list. I'd like to use a short form for constructing points where I only pass the coordinates. It would be concise and intuitive to use an approach like this
Point2D( { 2.0, 3.0 } )
That construct compiles with g++, icpc and cygwin64 and these parts in pipeline #6872 greenlight. However, clang produces the warning
./../../src/tinyhhg_core/mesh/MeshGenRectangle.cpp:179:77: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
meshInfo.vertices_[idx] = MeshInfo::Vertex( idx, Point3D( { midx, midy, 0.0 } ), Inner );
^~~~~~~~~~~~~~~
{ }
which results in a failure due to the -Werror. This issue was also encountered by @daniel, see commit cffe5cc9. My question is, whether me being new to the newer C++ versions, am making a conceptual error, or is this an issue with clang as seems to be indicated by https://stackoverflow.com/questions/31555584/why-is-clang-warning-suggest-braces-around-initialization-of-subobject-wmis?
I can produce similar warnings in g++, when I enforce the -Wmissing-braces option, but that option was deliberately excluded from -Wall for C++ with GCC. I tried to solve the problem by adding additional braces as suggested by clang, but that makes the code incompilable with g++ because it now is unsure which constructor it should invoke
candidate: hhg::PointND<T, N>::PointND(const hhg::PointND<T, N>&) [with T = double; long unsigned int N = 2]
PointND(const PointND& b)
candidate: hhg::PointND<T, N>::PointND(std::array<_Tp, _Nm>) [with T = double; long unsigned int N = 2]
PointND(std::array<T, N> list)
Any suggestions?
Cheers
Marcus