https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86476

            Bug ID: 86476
           Summary: Members declared later in a class appear to be
                    unavailable
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follows:

template <typename T>
struct A {
  void f() noexcept(noexcept(m.f())) {
    m.f();
  }
  T m;
};
struct B { void f(); };
int main() {
  A<B> a;
  a.f();
}

g++ produces:
 error: 'm' was not declared in this scope
  void f() noexcept(noexcept(m.f())) {


What gives? Surely A is complete in this context and we can see m?

I tried clang++. It accepts the code.

Reply via email to