ahatanak marked 2 inline comments as done.
ahatanak added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:12053
+                            NTCUC_UninitAutoVar);
     }
+
----------------
rjmccall wrote:
> Please add a comment explaining why this is specific to local variables.
I was trying to explain why this should be specific to local variables and 
realized that it's not clear to me whether it should be.

Suppose there is a union with two fields that are both non-trivial:

```
union U {
  Type A a;
  Type B a;
};

U global;
```

In this case, is value-initialization (which is essentially 
default-initialization plus a bunch of zero-initialization as per our previous 
discussion) used to initialize `global`? If so, should we reject the code since 
it requires default-initialization? It should be fine if we can assume 
default-initialization means zero-initialization for non-trivial types in C, 
but what if `TypeA` or `TypeB` requires initializing to a non-zero value?


Repository:
  rC Clang

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

https://reviews.llvm.org/D63753



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

Reply via email to