iains / gcc-darwin-arm64

GCC master branch for Darwin with experimental support for Arm64. Currently GCC-15.0.0 [September 2024]
GNU General Public License v2.0
268 stars 33 forks source link

aarch64.cc compilation error #127

Closed erzyadev closed 7 months ago

erzyadev commented 7 months ago

I believe I'm using apple clang with libc++ as stage 1 bootstrap, and receive the following compilation error here

  static constexpr std::pair<unsigned int, char> tiles[] = {
    { 0xff, 'b' },
    { 0x55, 'h' },
    { 0x11, 's' },
    { 0x01, 'd' }
  };

../.././gcc/config/aarch64/aarch64.cc:13654:50: error: constexpr variable 'tiles' must be initialized by a constant expression static constexpr std::pair<unsigned int, char> tiles[] = { ../.././gcc/config/aarch64/aarch64.cc:13655:5: note: non-constexpr constructor 'pair<int, char, nullptr>' cannot be used in a constant expression { 0xff, 'b' }, ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/pair.h:219:5: note: declared here pair(_U1&& __u1, _U2&& __u2)

Apparently, std::pair's ctor became constexpr only in C++14. However, libstdc++ backported it to C++11 while libc++ followed the standards (https://godbolt.org/z/1fq4chW88).

Manual replacing "g++ -std=c++11" with "g++ -std=c++14" in the Makefile worked for me as a temporary solution.

iains commented 7 months ago

thanks for the report; it should be possible to bootstrap the compiler with a conforming C++11 compiler - so I think we need to figure this out (I did not yet have a chance to try to repeat the issue)

iains commented 7 months ago

this is now GCC BZ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113763 so closing here.