I am a bit lost. I have to make an exercise, and the test probes return:
====== Sortie de g++ (1): ======
/tmp/tmpl2vzw2/test.cc: In function ‘_1aa6692b7e103514443a9d5e8f587e7::Triangle _4f13de2a0832e55e13a4f01e7e070c807d::trois_plus_proches(const _1aa6692b7e103514443a9d5e8f587e7::Point&, const Commune&)’:
/tmp/tmpl2vzw2/test.cc:152:13: error: passing ‘const _1aa6692b7e103514443a9d5e8f587e7::Point’ as ‘this’ argument of ‘_1aa6692b7e103514443a9d5e8f587e7::Point& _1aa6692b7e103514443a9d5e8f587e7::Point::operator=(_1aa6692b7e103514443a9d5e8f587e7::Point&&)’ discards qualifiers [-fpermissive]
result[0] = REFERENCE::plus_proche(depart, village);
^
compilation terminated due to -Wfatal-errors.
====== Sortie de clang++ (1): ======
/tmp/tmpl2vzw2/test.cc:152:13: fatal error: no viable overloaded '='
result[0] = REFERENCE::plus_proche(depart, village);
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpl2vzw2/student.cc:13:8: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const _1aa6692b7e103514443a9d5e8f587e7::Point', but method is not marked const
struct Point {
^
/tmp/tmpl2vzw2/student.cc:13:8: note: candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const _1aa6692b7e103514443a9d5e8f587e7::Point', but method is not marked const
struct Point {
^
1 error generated
http://www.eelis.net/iso-c++/testcase.xhtml
4. Make sure any line numbers you mention in the testcase are correct
6. Make sure your testcase is self-contained and actually reproduces the problem
It seems that you've got a constant point, and you want to modify it (assign it another point)
Also, perhaps you may also want the non-const version of `operator[]' for Triangle
> _1aa6692b7e103514443a9d5e8f587e7::Triangle
¿is that a namespace?
I haven't made the tests. They are an online tool that correct my exercise, that is why I don't know this code.
How can I correct it to use " the non-const version of `operator[]' for Triangle"? If I don't override the operator Triangle[], my program doesn't compile.
Also, @ne555 was referring to the problems with your 'testcase', NOT the tests themselves. As in, the things you are posting here. We want to have something that we can compile and run ourselves, get the same output as you, and then fiddle with to help you fix your problem. Just for future reference.