[PATCH] D133711: [Sema] Reject array element types whose sizes aren't a multiple of their alignments

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 04:26:46 PDT 2022


hans added a comment.

This also fires in non-array cases:

  $ cat /tmp/a.cc
  struct T0 { char c; };
  struct T2 : virtual T0 { };
  
  T2* f() { return new T2(); }
  
  $ /work/llvm-project/build/bin/clang++ -c -target i686-pc-win32 /tmp/a.cc
  /tmp/a.cc:4:22: error: size of array element of type 'T2' (5 bytes) isn't a multiple of its alignment (4 bytes)
  T2* f() { return new T2(); }
                       ^
  1 error generated.

I don't think we want to error here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133711/new/

https://reviews.llvm.org/D133711



More information about the cfe-commits mailing list