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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Stas Sergeev from comment #4)
> (In reply to Andrew Pinski from comment #3)
> > One more note, default argument clause does not apply here as the it is not
> > an argument of a method of that class but rather a different context (the
> > lamdba definition context).
> 
> Yes, but doesn't this apply to the note4?
> [Note 4: A complete-class context of a nested class is also a complete-class
> context of any enclosing class, if the nested class is defined within the
> member-specification of the enclosing class.
> — end note]
> 
> Isn't lambda an instance of a nested class here?

Nope, lamdba's are not a nested class.

> 
> > int off_p = offsetof(A, a);
> > is well formed due to it being a DMI.
> 
> Thanks for info.
> Do you happen to know the particular reason
> why the standard disallows this for static
> member? Shouldn't that be a DR?

Considering all compilers agree, it is not usually a defect report.
I also don't see how this would work in really because you could use a `static
constexpr` as an size for an array.

That is:
```
#include <cstddef>
struct A {
    static constexpr int (*off_p)(int p) =
        [](int off = offsetof(A, a))  { return off; };
    int t[off_p(1)];
    char a;
};
```

Reply via email to