Gecode / gecode

Generic Constraint Development Environment
https://www.gecode.org
Other
283 stars 76 forks source link

clang-10: error: no viable overloaded '=' #94

Closed yurivict closed 4 years ago

yurivict commented 4 years ago
/usr/bin/c++ -DGECODE_HAS_CPPROFILER -Dgecodeset_EXPORTS -Igecodeset_autogen/include -I/usr/ports/devel/gecode/work/gecode-release-6.2.0 -I. -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -std=c++11 -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -fPIC -std=gnu++11 -MD -MT CMakeFiles/gecodeset.dir/gecode/set/cardinality.cpp.o -MF CMakeFiles/gecodeset.dir/gecode/set/cardinality.cpp.o.d -o CMakeFiles/gecodeset.dir/gecode/set/cardinality.cpp.o -c /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/cardinality.cpp
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/cardinality.cpp:39:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int.hh:296:
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int/weights.hpp:127:14: error: no viable overloaded '='
    elements = elements0; weights = weights0;
    ~~~~~~~~ ^ ~~~~~~~~~
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray<int>', but method is not marked const
  class SharedArray : public SharedHandle {
        ^
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/cardinality.cpp:39:
In file included from /usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int.hh:296:
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/set/int/weights.hpp:127:35: error: no viable overloaded '='
    elements = elements0; weights = weights0;
                          ~~~~~~~ ^ ~~~~~~~~
/usr/ports/devel/gecode/work/gecode-release-6.2.0/gecode/kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray<int>', but method is not marked const
  class SharedArray : public SharedHandle {
        ^

FreeBSD 12.2

yurivict commented 4 years ago

This appears to be a valid C++ problem.

The constant field elements https://github.com/Gecode/gecode/blob/master/gecode/set/int/weights.hpp#L52 is assigned outside of constructor.

Removing the const attribute from the field definition fixes this failure.

zayenz commented 4 years ago

This has been fixed for the next release: https://github.com/Gecode/gecode/commit/c810c96b1ce5d3692e93439f76c4fa7d3daf9fbb