tbaeder added inline comments.

================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1240
+  // Fields
+  for (const Record::Field &Field : R->fields()) {
+    const Descriptor *D = Field.Desc;
----------------
aaron.ballman wrote:
> It looks like you're not initializing base classes or padding bits: 
> http://eel.is/c++draft/dcl.init#general-6.2 -- we could use test coverage for 
> both of those cases (don't forget to also test bit-fields). You should also 
> have a test for zero init of unions.
Unions and bitfields are generally not supported yet, and I'm not sure what you 
mean by padding bits - they don't exist at this stage. In storage however, they 
are always zero since we memset that to 0.


================
Comment at: clang/lib/AST/Interp/Descriptor.cpp:281-289
+QualType Descriptor::getElemQualType() const {
+  assert(isArray());
+  QualType T = getType();
+
+  const auto *CAT = cast<ConstantArrayType>(T);
+  return CAT->getElementType();
+
----------------
aaron.ballman wrote:
> This looks pretty dangerous -- is it safe to assume the type is a constant 
> array, or should this be a `dyn_cast` and the spurious `return` is for the 
> `else` branch?
I only need an `ArrayType` anyway, so should be fine.


================
Comment at: clang/test/AST/Interp/records.cpp:931
+    constexpr int foo(S x) {
+      return x.a; // expected-note {{read of object outside its lifetime}} \
+                  // ref-note {{read of uninitialized object}}
----------------
aaron.ballman wrote:
> Why is `x.a` outside of its lifetime?
That was just a wrong diagnostic that has since been fixed.


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

https://reviews.llvm.org/D154189

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to