C++: add a test for __builtin_complex

This commit is contained in:
Nick Rolfe
2019-10-11 13:37:24 +01:00
parent 682832fc55
commit 6c83c76268
3 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
| 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 |
| 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 |
| 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 |
| 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 |

View File

@@ -0,0 +1,7 @@
import cpp
from BuiltInComplexOperation bico, Expr real, Expr imag
where
real = bico.getRealOperand() and
imag = bico.getImaginaryOperand()
select bico, bico.getType(), real, real.getType(), imag, imag.getType()

View File

@@ -0,0 +1,10 @@
void builtin_double(double real, double imag) {
_Complex double a = __builtin_complex(real, imag);
_Complex double b = __builtin_complex(2.71828, 3.14159);
}
void builtin_float(float realf, float imagf) {
_Complex float c = __builtin_complex(realf, imagf);
_Complex float d = __builtin_complex(1.23f, 4.56f);
}