ahatanak added inline comments.

================
Comment at: lib/AST/ExprConstant.cpp:5236
     if (Frame) {
-      Result.set(VD, Frame->Index);
+      Result.set({VD, Frame->Index});
       return true;
----------------
rsmith wrote:
> Hmm. We should be versioning local variables as well. Currently we'll accept 
> invalid code such as:
> 
> ```
> constexpr int f() {
>   int *p = nullptr;
>   for (int k = 0; k != 2; ++k) {
>     int local_var = 0;
>     if (k == 0)
>       p = &local_var;
>     else
>       return *p;
>   }
> }
> static_assert(f() == 0);
> ```
I made changes to the constructor and destructor of ScopeRAII so that a version 
is pushed at the start of a new iteration. This fixes the FIXME in 
test/SemaCXX/constant-expression-cxx1y.cpp.


https://reviews.llvm.org/D42776



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

Reply via email to