cubicdaiya / dtl

diff template library written by C++
Other
283 stars 51 forks source link

Compile errors with new GCC 14.1.1 #20

Closed UffeJakobsen closed 3 months ago

UffeJakobsen commented 5 months ago

Compile errors with new GCC 14.1.1 (on archlinux)

Below is the output from attempting to build the test subdir:

test (master u=) 0 % scons                                                                                                                                                                                                                             [15:39:56]
scons: Reading SConscript files ...
Checking whether the C++ compiler works... (cached) yes
Checking for C library stdc++... (cached) yes
Checking for C library pthread... (cached) yes
Checking for C library gtest... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
g++ -o Intdifftest.o -c -std=c++11 -Wall -O2 -I/tmp/uj.tmpdir/dtl.git Intdifftest.cpp
In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from dtl_test_common.hpp:5,
                 from Intdifftest.cpp:1:
/usr/include/gtest/internal/gtest-port.h:279:2: error: #error C++ versions less than C++14 are not supported.
  279 | #error C++ versions less than C++14 are not supported.
      |  ^~~~~
/usr/include/gtest/gtest-assertion-result.h: In member function 'void testing::AssertionResult::AppendMessage(const testing::Message&)':
/usr/include/gtest/gtest-assertion-result.h:207:48: error: 'make_unique' is not a member of 'std'
  207 |     if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
      |                                                ^~~~~~~~~~~
/usr/include/gtest/gtest-assertion-result.h:207:48: note: 'std::make_unique' is only available from C++14 onwards
/usr/include/gtest/gtest-assertion-result.h:207:73: error: expected primary-expression before '>' token
  207 |     if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
      |                                                                         ^
/usr/include/gtest/gtest-assertion-result.h:207:75: error: expected primary-expression before ')' token
  207 |     if (message_ == nullptr) message_ = ::std::make_unique<::std::string>();
      |                                                                           ^
In file included from /usr/include/gtest/gtest-printers.h:122,
                 from /usr/include/gtest/gtest-matchers.h:49,
                 from /usr/include/gtest/internal/gtest-death-test-internal.h:47,
                 from /usr/include/gtest/gtest-death-test.h:43,
                 from /usr/include/gtest/gtest.h:65:
/usr/include/gtest/internal/gtest-internal.h: At global scope:
/usr/include/gtest/internal/gtest-internal.h:622:58: error: wrong number of template arguments (0, should be 1)
  622 |   typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
      |                                                          ^
In file included from /usr/include/c++/14.1.1/string:49,
                 from /usr/include/c++/14.1.1/bits/locale_classes.h:40,
                 from /usr/include/c++/14.1.1/bits/ios_base.h:41,
                 from /usr/include/c++/14.1.1/iomanip:42,
                 from /usr/include/gtest/gtest.h:54:
/usr/include/c++/14.1.1/bits/stl_function.h:400:12: note: provided for 'template<class _Tp> struct std::less'
  400 |     struct less : public binary_function<_Tp, _Tp, bool>
      |            ^~~~
/usr/include/gtest/internal/gtest-internal.h:622:59: error: template argument 3 is invalid
  622 |   typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
      |                                                           ^~
/usr/include/gtest/internal/gtest-internal.h: In member function 'bool testing::internal::TypedTestSuitePState::AddTestName(const char*, int, const char*, const char*)':
/usr/include/gtest/internal/gtest-internal.h:599:23: error: request for member 'insert' in '((testing::internal::TypedTestSuitePState*)this)->testing::internal::TypedTestSuitePState::registered_tests_', which is of non-class type 'testing::internal::TypedTestSuitePState::RegisteredTestsMap' {aka 'int'}
  599 |     registered_tests_.insert(
      |                       ^~~~~~
/usr/include/gtest/internal/gtest-internal.h: In member function 'bool testing::internal::TypedTestSuitePState::TestExists(const std::string&) const':
/usr/include/gtest/internal/gtest-internal.h:605:30: error: request for member 'count' in '((const testing::internal::TypedTestSuitePState*)this)->testing::internal::TypedTestSuitePState::registered_tests_', which is of non-class type 'const testing::internal::TypedTestSuitePState::RegisteredTestsMap' {aka 'const int'}
  605 |     return registered_tests_.count(test_name) > 0;
      |                              ^~~~~
/usr/include/gtest/internal/gtest-internal.h: In member function 'const testing::internal::CodeLocation& testing::internal::TypedTestSuitePState::GetCodeLocation(const std::string&) const':
/usr/include/gtest/internal/gtest-internal.h:609:40: error: qualified-id in declaration before 'it'
  609 |     RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
      |                                        ^~
/usr/include/gtest/internal/gtest-internal.h:610:5: error: 'it' was not declared in this scope; did you mean 'int'?
  610 |     GTEST_CHECK_(it != registered_tests_.end());
      |     ^~~~~~~~~~~~
/usr/include/gtest/internal/gtest-internal.h:610:5: error: request for member 'end' in '((const testing::internal::TypedTestSuitePState*)this)->testing::internal::TypedTestSuitePState::registered_tests_', which is of non-class type 'const testing::internal::TypedTestSuitePState::RegisteredTestsMap' {aka 'const int'}
  610 |     GTEST_CHECK_(it != registered_tests_.end());
      |     ^~~~~~~~~~~~
/usr/include/gtest/internal/gtest-internal.h:611:12: error: 'it' was not declared in this scope; did you mean 'int'?
  611 |     return it->second;
      |            ^~
      |            int
/usr/include/gtest/gtest-matchers.h: At global scope:
/usr/include/gtest/gtest-matchers.h:725:75: error: wrong number of template arguments (0, should be 1)
  725 | class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>> {
      |                                                                           ^
/usr/include/c++/14.1.1/bits/stl_function.h:370:12: note: provided for 'template<class _Tp> struct std::equal_to'
  370 |     struct equal_to : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~
/usr/include/gtest/gtest-matchers.h:725:76: error: template argument 3 is invalid
  725 | class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>> {
      |                                                                            ^~
/usr/include/gtest/gtest-matchers.h: In constructor 'testing::internal::EqMatcher<Rhs>::EqMatcher(const Rhs&)':
/usr/include/gtest/gtest-matchers.h:728:58: error: wrong number of template arguments (0, should be 1)
  728 |       : ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>>(rhs) {}
      |                                                          ^
/usr/include/c++/14.1.1/bits/stl_function.h:370:12: note: provided for 'template<class _Tp> struct std::equal_to'
  370 |     struct equal_to : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~
/usr/include/gtest/gtest-matchers.h:728:59: error: template argument 3 is invalid
  728 |       : ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>>(rhs) {}
      |                                                           ^~
/usr/include/gtest/gtest-matchers.h:728:61: error: expected '{' before '(' token
  728 |       : ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>>(rhs) {}
      |                                                             ^
/usr/include/gtest/gtest-matchers.h: At global scope:
/usr/include/gtest/gtest-matchers.h:734:67: error: wrong number of template arguments (0, should be 1)
  734 |     : public ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>> {
      |                                                                   ^
/usr/include/c++/14.1.1/bits/stl_function.h:380:12: note: provided for 'template<class _Tp> struct std::not_equal_to'
  380 |     struct not_equal_to : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~~~~~
/usr/include/gtest/gtest-matchers.h:734:68: error: template argument 3 is invalid
  734 |     : public ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>> {
      |                                                                    ^~
/usr/include/gtest/gtest-matchers.h: In constructor 'testing::internal::NeMatcher<Rhs>::NeMatcher(const Rhs&)':
/usr/include/gtest/gtest-matchers.h:737:62: error: wrong number of template arguments (0, should be 1)
  737 |       : ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>>(rhs) {}
      |                                                              ^
/usr/include/c++/14.1.1/bits/stl_function.h:380:12: note: provided for 'template<class _Tp> struct std::not_equal_to'
  380 |     struct not_equal_to : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~~~~~
/usr/include/gtest/gtest-matchers.h:737:63: error: template argument 3 is invalid
  737 |       : ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>>(rhs) {}
      |                                                               ^~
/usr/include/gtest/gtest-matchers.h:737:65: error: expected '{' before '(' token
  737 |       : ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>>(rhs) {}
      |                                                                 ^
/usr/include/gtest/gtest-matchers.h: At global scope:
/usr/include/gtest/gtest-matchers.h:742:71: error: wrong number of template arguments (0, should be 1)
  742 | class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>> {
      |                                                                       ^
/usr/include/c++/14.1.1/bits/stl_function.h:400:12: note: provided for 'template<class _Tp> struct std::less'
  400 |     struct less : public binary_function<_Tp, _Tp, bool>
      |            ^~~~
/usr/include/gtest/gtest-matchers.h:742:72: error: template argument 3 is invalid
  742 | class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>> {
      |                                                                        ^~
/usr/include/gtest/gtest-matchers.h: In constructor 'testing::internal::LtMatcher<Rhs>::LtMatcher(const Rhs&)':
/usr/include/gtest/gtest-matchers.h:745:54: error: wrong number of template arguments (0, should be 1)
  745 |       : ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>>(rhs) {}
      |                                                      ^
/usr/include/c++/14.1.1/bits/stl_function.h:400:12: note: provided for 'template<class _Tp> struct std::less'
  400 |     struct less : public binary_function<_Tp, _Tp, bool>
      |            ^~~~
/usr/include/gtest/gtest-matchers.h:745:55: error: template argument 3 is invalid
  745 |       : ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>>(rhs) {}
      |                                                       ^~
/usr/include/gtest/gtest-matchers.h:745:57: error: expected '{' before '(' token
  745 |       : ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>>(rhs) {}
      |                                                         ^
/usr/include/gtest/gtest-matchers.h: At global scope:
/usr/include/gtest/gtest-matchers.h:750:74: error: wrong number of template arguments (0, should be 1)
  750 | class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>> {
      |                                                                          ^
/usr/include/c++/14.1.1/bits/stl_function.h:390:12: note: provided for 'template<class _Tp> struct std::greater'
  390 |     struct greater : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~
/usr/include/gtest/gtest-matchers.h:750:75: error: template argument 3 is invalid
  750 | class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>> {
      |                                                                           ^~
/usr/include/gtest/gtest-matchers.h: In constructor 'testing::internal::GtMatcher<Rhs>::GtMatcher(const Rhs&)':
/usr/include/gtest/gtest-matchers.h:753:57: error: wrong number of template arguments (0, should be 1)
  753 |       : ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>>(rhs) {}
      |                                                         ^
/usr/include/c++/14.1.1/bits/stl_function.h:390:12: note: provided for 'template<class _Tp> struct std::greater'
  390 |     struct greater : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~
/usr/include/gtest/gtest-matchers.h:753:58: error: template argument 3 is invalid
  753 |       : ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>>(rhs) {}
      |                                                          ^~
/usr/include/gtest/gtest-matchers.h:753:60: error: expected '{' before '(' token
  753 |       : ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>>(rhs) {}
      |                                                            ^
/usr/include/gtest/gtest-matchers.h: At global scope:
/usr/include/gtest/gtest-matchers.h:759:65: error: wrong number of template arguments (0, should be 1)
  759 |     : public ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>> {
      |                                                                 ^
/usr/include/c++/14.1.1/bits/stl_function.h:420:12: note: provided for 'template<class _Tp> struct std::less_equal'
  420 |     struct less_equal : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~~~
/usr/include/gtest/gtest-matchers.h:759:66: error: template argument 3 is invalid
  759 |     : public ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>> {
      |                                                                  ^~
/usr/include/gtest/gtest-matchers.h: In constructor 'testing::internal::LeMatcher<Rhs>::LeMatcher(const Rhs&)':
/usr/include/gtest/gtest-matchers.h:762:60: error: wrong number of template arguments (0, should be 1)
  762 |       : ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>>(rhs) {}
      |                                                            ^
/usr/include/c++/14.1.1/bits/stl_function.h:420:12: note: provided for 'template<class _Tp> struct std::less_equal'
  420 |     struct less_equal : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~~~
/usr/include/gtest/gtest-matchers.h:762:61: error: template argument 3 is invalid
  762 |       : ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>>(rhs) {}
      |                                                             ^~
/usr/include/gtest/gtest-matchers.h:762:63: error: expected '{' before '(' token
  762 |       : ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>>(rhs) {}
      |                                                               ^
/usr/include/gtest/gtest-matchers.h: At global scope:
/usr/include/gtest/gtest-matchers.h:768:68: error: wrong number of template arguments (0, should be 1)
  768 |     : public ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>> {
      |                                                                    ^
/usr/include/c++/14.1.1/bits/stl_function.h:410:12: note: provided for 'template<class _Tp> struct std::greater_equal'
  410 |     struct greater_equal : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~~~~~~
/usr/include/gtest/gtest-matchers.h:768:69: error: template argument 3 is invalid
  768 |     : public ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>> {
      |                                                                     ^~
/usr/include/gtest/gtest-matchers.h: In constructor 'testing::internal::GeMatcher<Rhs>::GeMatcher(const Rhs&)':
/usr/include/gtest/gtest-matchers.h:771:63: error: wrong number of template arguments (0, should be 1)
  771 |       : ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>>(rhs) {}
      |                                                               ^
/usr/include/c++/14.1.1/bits/stl_function.h:410:12: note: provided for 'template<class _Tp> struct std::greater_equal'
  410 |     struct greater_equal : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~~~~~~
/usr/include/gtest/gtest-matchers.h:771:64: error: template argument 3 is invalid
  771 |       : ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>>(rhs) {}
      |                                                                ^~
/usr/include/gtest/gtest-matchers.h:771:66: error: expected '{' before '(' token
  771 |       : ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>>(rhs) {}
      |                                                                  ^
/usr/include/gtest/gtest.h: At global scope:
/usr/include/gtest/gtest.h:302:30: error: 'std::enable_if_t' has not been declared
  302 |   template <typename T, std::enable_if_t<std::is_convertible<T, int64_t>::value,
      |                              ^~~~~~~~~~~
/usr/include/gtest/gtest.h:302:41: error: expected '>' before '<' token
  302 |   template <typename T, std::enable_if_t<std::is_convertible<T, int64_t>::value,
      |                                         ^
In file included from /tmp/uj.tmpdir/dtl.git/dtl/dtl.hpp:44,
                 from dtl_test_common.hpp:12:
/tmp/uj.tmpdir/dtl.git/dtl/Diff.hpp: In member function 'void dtl::Diff<elem, sequence, comparator>::enableTrivial() const':
/tmp/uj.tmpdir/dtl.git/dtl/Diff.hpp:168:27: error: assignment of member 'trivial' in read-only object
  168 |             this->trivial = true;
      |             ~~~~~~~~~~~~~~^~~~~~
scons: *** [Intdifftest.o] Error 1
scons: building terminated because of errors.
UffeJakobsen commented 5 months ago

At least one of the errors will be fixed by merging PR https://github.com/cubicdaiya/dtl/pull/18

cbv444 commented 4 months ago

The declaration of 'enableTrivial' could be changed to remove 'const' to fix the last error -

--- a/dtl/Diff.hpp
+++ b/dtl/Diff.hpp
@@ -164,7 +164,7 @@ namespace dtl {
             return trivial;
         }

-        void enableTrivial () const {
+        void enableTrivial () {
             this->trivial = true;
         }
UffeJakobsen commented 4 months ago

The declaration of 'enableTrivial' could be changed to remove 'const' to fix the last error -

Thanks - but that is already documented in several (linked) PR on this project - what we need it for the project owner to merge the changes in the PRs...

UffeJakobsen commented 3 months ago

This issue can be closed - solved with the release of v1.21 - thanks :+1: