C++11 noexcept qualifier and inline methods

Viewed 2135

Does C++11 give any guarantees about inline functions or methods, when they make calls to other functions declared with the noexcept qualifier?

class My_String { ...

    const char * c_str () const noexcept;
    inline operator const char * () const { return c_str(); }
};

I assume an optimizing compiler would be free to implement the inline method without full EH and stack unwinding, as per the noexcept qualification. I would also expect this for a simple accessor method too:

... inline operator const char * () const { return m_buffer; }

While this example looks trivial, exception guarantees matter when used to implement other classes or functions. Q: Does the C++11 standard address this or should inline methods be marked noexcept? Or is it better to omit noexcept unless required to match a class or function specification?

Edit: To avoid some confusion: Is noexcept implicit for the inline method?

1 Answers
Related