[PATCH] D24333: [CleanupInfo] Use cleanupsHaveSideEffects instead of exprNeedsCleanups in assertions
Richard Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 30 13:26:55 PST 2017
rsmith added inline comments.
================
Comment at: clang/test/SemaCXX/pr30306.cpp:5
+template <typename T>
+void g(T) { int a[f(3)]; } // expected-no-diagnostics
+
----------------
Shouldn't we be (somehow) handling the cleanups from the array bound expression here -- either discarding them or attaching them to the array bound? Looks like `TreeTransform::TransformVariableArrayType` is missing a call to `ActOnFinishFullExpr`.
If we modify the test to:
```
struct A { A(int); ~A(); };
int f(const A &);
template<typename T> void g() { int a[f(3)]; }
int main() { g<int>(); }
```
... we need to register the `~A()` destructor to actually be run at some point.
https://reviews.llvm.org/D24333
More information about the cfe-commits
mailing list