这个 noexcept 声明有效吗?

Is this noexcept declaration valid?

struct X
{
    void f() noexcept(noexcept(g()));
    void g() noexcept;
};

在 vc++ 和 clang 中,这有效,但 gcc 抱怨:

source_file.cpp:6:34: error: ‘g’ was not declared in this scope
     void f() noexcept(noexcept(g()));
                                  ^

我认为这是 gcc 中的错误,而不是其他版本中的功能。对吗?

您的评价是correct

Within the class member-specification, the class is regarded as complete within function bodies, default arguments, noexcept-specifiers, and default member initializers (including such things in nested classes). Otherwise it is regarded as incomplete within its own class member-specification.

在一个完整类型的范围内,g应该被unqualified name lookup找到。