Can we refer to member variables in a noexcept specification?

后端 未结 1 1358
鱼传尺愫
鱼传尺愫 2021-02-14 09:00

Please consider the following code snippet:

template
class vector
{
public:
    typename Tuple::size_type size() const noexcept(noexcept(m_ele         


        
相关标签:
1条回答
  • 2021-02-14 09:14

    Clang is correct here, this is gcc bug 52869. According to [basic.scope.class], emphasis mine:

    The potential scope of a name declared in a class consists not only of the declarative region following the name’s point of declaration, but also of all function bodies, default arguments, exception-specifications, and brace-or-equal-initializers of non-static data members in that class (including such things in nested classes).

    The scope of m_elements includes the noexcept-specification for size().

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