error: non-const lvalue reference to type 'basic_ostringstream<...>' cannot bind to a temporary of type 'basic_ostringstream<...

Submitted by yurivict on Fri, 11/02/2018 - 07:39

The build fails on FreeBSD 11.2 with clang-6:

---error log---
ICAL_ACTIVE_FLAG -c ../fix_nve_superquadric.cpp
In file included from ../fix_contact_property_atom_wall.cpp:48:
In file included from ../fix_wall_gran.h:55:
In file included from ../granular_wall.h:44:
../utils.h:70:12: error: non-const lvalue reference to type 'basic_ostringstream<...>' cannot bind to a temporary of type 'basic_ostringstream<...>'
return static_cast< std::ostringstream & >(( std::ostringstream() << std::dec << a ) ).str();
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../finish.cpp:722:40: error: ordered comparison between pointer and zero ('int *' and 'int')
if (neighbor->lists[m]->numneigh > 0) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~

../math_vector.h:97:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
register double f = sqrt(vec_dot(dest, dest));
^~~~~~~~~
../math_vector.h:225:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
register double det = form_det(m);
^~~~~~~~~
../math_vector.h:380:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
register double f = m[6]*m[7]-m[5]*m[8];
^~~~~~~~~
../math_vector.h:390:3: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
register double det = form4_det(m);
^~~~~~~~~
In file included from ../compute_ke_multisphere.cpp:47:
../fix_multisphere.h:138:13: warning: 'LAMMPS_NS::FixMultisphere::extract' hides overloaded virtual function [-Woverloaded-virtual]
void *extract(const char *name, int &len1, int &len2)
^

These are printed despite USE_VTK="OFF":

In file included from ../style_dump.h:11:
../dump_mesh_vtk.h:59:41: error: expected class name
class DumpMeshVTK : public Dump, public DumpVTK {
^
../dump_mesh_vtk.h:78:5: error: unknown type name 'DumpMesh'
DumpMesh *dumpMesh_;
^
../dump_mesh_vtk.h:81:5: error: no template named 'vtkSmartPointer'
vtkSmartPointer mbSet_;
^
../dump_mesh_vtk.h:81:21: error: use of undeclared identifier 'vtkMultiBlockDataSet'
vtkSmartPointer mbSet_;
^

arnom's picture

arnom | Thu, 11/15/2018 - 14:48

We don't do testing on FreeBSD, but we do test with clang. As we run ubuntu on our testing machine we use clang-3.8.

Also we don't support C++17. LIGGGHTS public runs with C++98 and will soon move to C++11.

The error in finish.cpp can be fixed by removing the "> 0". This is already fixed in our dev version.

I also removed the int_to_string function which causes your first error. All occurrences can be changed to std::to_string.

DCS team member & LIGGGHTS(R) core developer

liammo29 | Tue, 04/27/2021 - 05:39

I am stuck on the exact same issue and have been working for hours on it. How do I switch away from c++17?