drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.63k stars 1.12k forks source link

include exception header for std::exception_ptr #2159

Closed toge closed 2 months ago

toge commented 2 months ago

I met compilation errors on apple-clang 15. Error messages are following. This PR try to fix it.

[ 32%] Building CXX object CMakeFiles/drogon.dir/lib/src/RequestStream.cc.o
In file included from lib/src/RequestStream.cc:15:
In file included from lib/src/MultipartStreamParser.h:17:
lib/inc/drogon/RequestStream.h:95:38: error: no type named 'exception_ptr' in namespace 'std'; did you mean 'exception'?
    virtual void onStreamFinish(std::exception_ptr) = 0;
                                ~~~~~^~~~~~~~~~~~~
                                     exception
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__exception/exception.h:72:33: note: 'exception' declared here
class _LIBCPP_EXPORTED_FROM_ABI exception {
                                ^
In file included from lib/src/RequestStream.cc:15:
In file included from lib/src/MultipartStreamParser.h:17:
lib/inc/drogon/RequestStream.h:98:58: error: no member named 'exception_ptr' in namespace 'std'
    using StreamFinishCallback = std::function<void(std::exception_ptr)>;
                                                    ~~~~~^
lib/inc/drogon/RequestStream.h:102:45: error: unknown type name 'StreamFinishCallback'; did you mean 'StreamDataCallback'?
                                            StreamFinishCallback finishCb);
                                            ^~~~~~~~~~~~~~~~~~~~
                                            StreamDataCallback
lib/inc/drogon/RequestStream.h:97:11: note: 'StreamDataCallback' declared here
    using StreamDataCallback = std::function<void(const char *, size_t)>;
          ^
toge commented 2 months ago

@an-tao Thanks!