Unexpected exception in std::ifstream

前端 未结 1 1068
故里飘歌
故里飘歌 2020-12-11 17:48

Experimenting with I/O I get an exception where no exception should have been thrown:

#include 
#include 

int main()
{
    st         


        
1条回答
  •  自闭症患者
    2020-12-11 18:49

    It's a bug, and clang v3.4 with libc++ doesn't exhibit this behaviour; GCC 4.8's libstdc++ still does.

    From the libstdc++ source and the text of the exception, I'd say that basic_ios::clear is not catching exceptions thrown from down the call stack and applying the "are exception flags in play?" logic before potentially rethrowing them.

    It was already raised last year as bug 53984.

    0 讨论(0)
提交回复
热议问题