-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C++: Add test for C++20 implicit array sizes
Implement NewArrayExpr.getArraySize()
- Loading branch information
1 parent
57efb84
commit 29df3cb
Showing
5 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// semmle-extractor-options: -std=c++20 | ||
double a1[]{1,2,3}; | ||
double* p1 = new double[]{1,2,3}; | ||
double* p2 = new double[0]{}; | ||
double* p3 = new double[]{}; | ||
char c[]{"Hello"}; | ||
char* d = new char[]{"Hello"}; | ||
double a2[](1,2,3); | ||
double* p4 = new double[](1,2,3); | ||
double* p5 = new double[4]{1,2}; // Size mismatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
| implicit_sizes.cpp:3:14:3:32 | new[] | 3 | | ||
| implicit_sizes.cpp:4:14:4:28 | new[] | 0 | | ||
| implicit_sizes.cpp:5:14:5:27 | new[] | 0 | | ||
| implicit_sizes.cpp:7:11:7:29 | new[] | 6 | | ||
| implicit_sizes.cpp:9:14:9:32 | new[] | 3 | | ||
| implicit_sizes.cpp:10:14:10:31 | new[] | 4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import cpp | ||
|
||
from NewArrayExpr nae | ||
select nae, nae.getArraySize() |