Skip to content

Commit 152798a

Browse files
committed
[Math] Fix variable length array warning in RMinimzer
Fix the following warning: ```txt math/rtools/src/RMinimizer.cxx:28:19: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 28 | double z[size]; | ^~~~ math/rtools/src/RMinimizer.cxx:28:19: note: read of non-const variable 'size' is not allowed in a constant expression math/rtools/src/RMinimizer.cxx:26:23: note: declared here 26 | unsigned int size = y.GetNoElements(); | ^ ```
1 parent fa74d4f commit 152798a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

math/rtools/src/RMinimizer.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ namespace ROOT {
2525
TVectorD mingradfunction(TVectorD y){
2626
unsigned int size = y.GetNoElements();
2727
const double * yy = y.GetMatrixArray();
28-
double z[size];
29-
gGradFunction->Gradient(yy,z);
30-
TVectorD zz(size,z);
28+
TVectorD zz(size);
29+
gGradFunction->Gradient(yy,zz.data());
3130
return zz;
3231
}
3332

0 commit comments

Comments
 (0)