sap icon indicating copy to clipboard operation
sap copied to clipboard

What are the compiler requirements?

Open AlbertoGP opened this issue 1 year ago • 1 comments

Hi, just trying this out but the compilers I have installed do not work:

clang 12.0.1

$ make
# precompiling header source/include/precompile.h
# compiling pch
  source/watch/watch.cpp
  source/tree/wrapped_line.cpp
In file included from source/tree/wrapped_line.cpp:5:
In file included from source/include/tree/base.h:8:
In file included from source/include/sap/style.h:11:
source/include/sap/colour.h:79:11: error: expected unqualified-id
                                using enum Type;
                                      ^
source/include/sap/colour.h:80:10: error: 'RGB' does not refer to a value
                                case RGB: return m_rgb == other.m_rgb;
                                     ^
source/include/sap/colour.h:17:10: note: declared here
                struct RGB
                       ^
source/include/sap/colour.h:81:10: error: 'CMYK' does not refer to a value
                                case CMYK: return m_cmyk == other.m_cmyk;
                                     ^
source/include/sap/colour.h:27:10: note: declared here
                struct CMYK
                       ^
3 errors generated.

gcc 10

$ make
  source/tree/wrapped_line.cpp
In file included from source/include/defs.h:15,
                 from ./build/source/include/precompile.h:28,
                 from <command-line>:
source/include/units.h:349:35: error: extra ';' [-Werror=pedantic]
  349 | DEFINE_UNIT(millimetre, 1.0, void);
      |                                   ^
source/include/units.h:350:36: error: extra ';' [-Werror=pedantic]
  350 | DEFINE_UNIT(centimetre, 10.0, void);
      |                                    ^
In file included from ./build/source/include/precompile.h:30,
                 from <command-line>:
source/include/util.h:36:55: error: could not convert 'std::endian::big' from 'std::endian' to 'zst::impl::endian'
   36 |  using big_endian_span = zst::span<T, std::endian::big>;
      |                                                       ^
source/include/util.h:36:31: error: '<expression error>' in namespace 'zst' does not name a type
   36 |  using big_endian_span = zst::span<T, std::endian::big>;
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from source/include/sap/style.h:11,
                 from source/include/tree/base.h:8,
                 from source/tree/wrapped_line.cpp:5:
source/include/sap/colour.h: In member function 'constexpr bool sap::Colour::operator==(const sap::Colour&) const':
source/include/sap/colour.h:79:11: error: expected nested-name-specifier before 'enum'
   79 |     using enum Type;
      |           ^~~~
source/include/sap/colour.h:80:13: error: expected primary-expression before ':' token
   80 |     case RGB: return m_rgb == other.m_rgb;
      |             ^
source/include/sap/colour.h:81:14: error: expected primary-expression before ':' token
   81 |     case CMYK: return m_cmyk == other.m_cmyk;
      |              ^
source/include/sap/colour.h:77:10: error: enumeration value 'RGB' not handled in switch [-Werror=switch]
   77 |    switch(m_type)
      |          ^
source/include/sap/colour.h:77:10: error: enumeration value 'CMYK' not handled in switch [-Werror=switch]
cc1plus: all warnings being treated as errors
make: *** [Makefile:150: build/source/tree/wrapped_line.cpp.o] Error 1

gcc 11

$ make
  source/tree/wrapped_line.cpp
In file included from source/include/sap/style.h:11,
                 from source/include/tree/base.h:8,
                 from source/tree/wrapped_line.cpp:5:
source/include/sap/colour.h: In static member function ‘static constexpr sap::Colour sap::Colour::rgb(double, double, double)’:
source/include/sap/colour.h:50:25: error: ‘sap::Colour::<unnamed union>’ has no non-static data member named ‘r’
   50 |                         };
      |                         ^
source/include/sap/colour.h: In static member function ‘static constexpr sap::Colour sap::Colour::cmyk(double, double, double, double)’:
source/include/sap/colour.h:58:25: error: ‘sap::Colour::<unnamed union>’ has no non-static data member named ‘c’
   58 |                         };
      |                         ^
source/include/sap/colour.h: In static member function ‘static constexpr sap::Colour sap::Colour::grey(double)’:
source/include/sap/colour.h:66:25: error: ‘sap::Colour::<unnamed union>’ has no non-static data member named ‘c’
   66 |                         };
      |                         ^
make: *** [Makefile:150: build/source/tree/wrapped_line.cpp.o] Error 1

Those are old compilers so it’s reasonable to require a more recent one, but I’d like to know which one would work.

AlbertoGP avatar Oct 16 '23 06:10 AlbertoGP

I've tested it with GCC 13.2.1 and Clang 15. I've also just pushed a fix for some dumb C++20 problem.

zhiayang avatar Oct 16 '23 08:10 zhiayang