daeisbae / AParser

Yet another programming language for educational purpose and simplicity
https://daeisbae.github.io/AParser/
MIT License
1 stars 0 forks source link

AppleClang does not compile, while GCC compiles #44

Closed daeisbae closed 7 months ago

daeisbae commented 7 months ago

Problem

Previous environment: g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Current environment: Apple clang version 15.0.0 (clang-1500.1.0.2.5)

Error Information

Error 1

[  3%] Building CXX object operator/CMakeFiles/operator.dir/operator.cpp.o
In file included from /Users/daehyung/Desktop/Programming/AParser/operator/operator.cpp:1:
/Users/daehyung/Desktop/Programming/AParser/operator/operator.hpp:58:9: error: invalid operands to binary expression ('std::ostream' (aka 'basic_ostream<char>') and 'const char[19]')
    out << "Operator( Value: \'" << op.value << "\' )";
    ~~~ ^  ~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/cstddef:125:3: note: candidate function template not viable: cannot convert argument of incomplete type 'std::ostream' (aka 'basic_ostream<char>') to 'byte' for 1st argument
  operator<< (byte  __lhs, _Integer __shift) noexcept
  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1927:1: note: candidate template ignored: could not match 'const shared_ptr<_Yp>' against 'const char[19]'
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/string_view:947:1: note: candidate template ignored: could not match 'basic_string_view<_CharT, _Traits>' against 'const char *'
operator<<(basic_ostream<_CharT, _Traits>& __os,
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:258:1: note: candidate template ignored: could not match 'const uniform_int_distribution<_IT>' against 'const char[19]'
operator<<(basic_ostream<_CharT, _Traits>& __os,
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/string:4476:1: note: candidate template ignored: could not match 'const basic_string<_CharT, _Traits, _Allocator>' against 'const char[19]'
operator<<(basic_ostream<_CharT, _Traits>& __os,
^
1 error generated.
make[2]: *** [operator/CMakeFiles/operator.dir/operator.cpp.o] Error 1
make[1]: *** [operator/CMakeFiles/operator.dir/all] Error 2
make: *** [all] Error 2

Error 2

[ 53%] Built target runtime
[ 56%] Building CXX object CMakeFiles/AParser.dir/main.cpp.o
In file included from /Users/daehyung/Desktop/Programming/AParser/main.cpp:1:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/iostream:43:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/ios:221:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__locale:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/mutex:191:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/shared_ptr.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/unique_ptr.h:65:5: error: delete called on non-final 'NullExpression' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
    delete __ptr;
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/unique_ptr.h:297:7: note: in instantiation of member function 'std::default_delete<NullExpression>::operator()' requested here
      __ptr_.second()(__tmp);
      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/unique_ptr.h:263:75: note: in instantiation of member function 'std::unique_ptr<NullExpression>::reset' requested here
  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
                                                                          ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/shared_ptr.h:498:25: note: in instantiation of member function 'std::unique_ptr<NullExpression>::~unique_ptr' requested here
        unique_ptr<_Yp> __hold(__p);
                        ^
/Users/daehyung/Desktop/Programming/AParser/ast/ast.hpp:164:13: note: in instantiation of function template specialization 'std::shared_ptr<Expression>::shared_ptr<NullExpression, void>' requested here
    Value = ExpressionPtr(new NullExpression());
            ^
1 error generated.
make[2]: *** [CMakeFiles/AParser.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/AParser.dir/all] Error 2
make: *** [all] Error 2
daeisbae commented 7 months ago

Fixed in #45 (PR fixing Error 2) #46 (PR fixing Error 1)