ahatanak added inline comments.

================
Comment at: lib/AST/ExprConstant.cpp:597
+    }
+    void clearDefaultArgNum() { CurDefaultArgNum = 0; }
+    unsigned CurDefaultArgNum = 0, NextDefaultArgNum = 0;
----------------
rsmith wrote:
> This is wrong: these scopes can nest, so you can't just reset the number to 0 
> when you're done. You should restore the prior number when you're done here, 
> to divide up evaluation into CXXDefaultArgExpr scopes. (Technically, I think 
> it would also be correct to leave the number alone when you leave one of 
> these scopes, but only because a scope for a particular parameter's default 
> argument can't nest within another scope for the same default argument 
> expression -- and even that might not be true in the presence of template 
> instantiation.)
Do you mean VisitCXXDefaultArgExpr can be called the second time before the 
first call returns? Do you have an example code that would cause that to happen 
(which I can perhaps add as a test case)?

It seemed to me that that would happen only if you used a lambda expression for 
the default argument, but I thought the current standard doesn't allow using 
lambda expressions in constant expressions.


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