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

            Bug ID: 91055
           Summary: alignof () evaluated before layout is complete?
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For the following testcase the first static_assert fails but clang++ behavior
suggests applying alignof to a member that is still being defined is invalid.

struct T {
    char c __attribute__((aligned(64)));
};
struct U {
    T t;
    static_assert (alignof (t) == 64, "oops");
};
static_assert (alignof (U::t) == 64, "oops");

The following silently generates wrong code, instantiating X<0> instead of
X<64>.

struct T {
    char c __attribute__((aligned(64)));
};
template <int i> struct X {};
struct U {
    T t;
    X<alignof (t)> x;
};

Reply via email to