This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Throwing std::ios_base::failure on formatted input with gcc 6.2


On 26 October 2016 at 14:42, Edward Diener wrote:
> I am missing the syntactical difference between the two. There is
> 'std::ios_base::failure' and how do you specify the other one ? Your
> notation of 'std::ios_base::[abi:__cxx11]failure' I do not understand.
>

It comes from the abi_tag attribute documented at
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html

namespace std {
  struct ios_base {
    struct __attribute__((abi__tag__("cxx11"))) failure { };
  };
}

I got the demangled name slightly wrong, the attribute goes at the end:

#include <iostream>
int main()
{
  throw std::ios_base::failure("");
}
terminate called after throwing an instance of
'std::ios_base::failure[abi:cxx11]'
  what():  : iostream error
Aborted (core dumped)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]