Include override inside all the child class PrintOstream functions. #44
Implement virtual destructors in all child classes that contain PrintOstream functions. #44
Environment
MacOS Compiler Environment: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Error Information
[ 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
Changes
override
inside all the child classPrintOstream
functions. #44PrintOstream
functions. #44Environment
MacOS Compiler Environment:
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Error Information