Skip to content

Commit 6c83c76

Browse files
committed
C++: add a test for __builtin_complex
1 parent 682832f commit 6c83c76

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| complex.c:3:23:3:51 | __builtin_complex | file://:0:0:0:0 | _Complex double | complex.c:3:41:3:44 | real | file://:0:0:0:0 | double | complex.c:3:47:3:50 | imag | file://:0:0:0:0 | double |
2+
| complex.c:4:23:4:57 | __builtin_complex | file://:0:0:0:0 | _Complex double | complex.c:4:41:4:47 | 2.71828000000000003 | file://:0:0:0:0 | double | complex.c:4:50:4:56 | 3.141589999999999883 | file://:0:0:0:0 | double |
3+
| complex.c:8:22:8:52 | __builtin_complex | file://:0:0:0:0 | _Complex float | complex.c:8:40:8:44 | realf | file://:0:0:0:0 | float | complex.c:8:47:8:51 | imagf | file://:0:0:0:0 | float |
4+
| complex.c:9:22:9:52 | __builtin_complex | file://:0:0:0:0 | _Complex float | complex.c:9:40:9:44 | 1.230000019 | file://:0:0:0:0 | float | complex.c:9:47:9:51 | 4.559999943 | file://:0:0:0:0 | float |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import cpp
2+
3+
from BuiltInComplexOperation bico, Expr real, Expr imag
4+
where
5+
real = bico.getRealOperand() and
6+
imag = bico.getImaginaryOperand()
7+
select bico, bico.getType(), real, real.getType(), imag, imag.getType()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
void builtin_double(double real, double imag) {
3+
_Complex double a = __builtin_complex(real, imag);
4+
_Complex double b = __builtin_complex(2.71828, 3.14159);
5+
}
6+
7+
void builtin_float(float realf, float imagf) {
8+
_Complex float c = __builtin_complex(realf, imagf);
9+
_Complex float d = __builtin_complex(1.23f, 4.56f);
10+
}

0 commit comments

Comments
 (0)