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

--- Comment #7 from Toni Neubert <lutztonineubert at gmail dot com> ---
First of all thank you very much for your extremly fast help!
I testet the patch and it did work for my second example.

But this one still fails, if we do not use the addressof function:

struct A {
        virtual int get() = 0;
};
struct B : A {
        constexpr int get() override {
                return 10;
        }
};

struct D {
        B b[2];
        A* c{&(b[0])};
};

static_assert(D{}.c->get() == 10);

Error:

main.cpp:20:28: error: non-constant condition for static assertion
   20 | static_assert(D{}.c->get() == 10);
      |               ~~~~~~~~~~~~~^~~~~
main.cpp:20:28: error: expression 'A::get' is not a constant expression

Reply via email to