aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-01-29 21:17:47 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2023-02-21 15:12:19 +0100
commit8063de4a8cde958c34fbd2af4a25080709263c74 (patch)
tree8f90f098f89977e542b3898d81885ca0481fcd98 /gcc/testsuite/gdc.dg
parentdfd39ed30dd69a3613d47a83d3739923051734aa (diff)
downloadgcc-8063de4a8cde958c34fbd2af4a25080709263c74.zip
gcc-8063de4a8cde958c34fbd2af4a25080709263c74.tar.gz
gcc-8063de4a8cde958c34fbd2af4a25080709263c74.tar.bz2
d: Set doing_semantic_analysis_p before calling functionSemantic3
As functions which have semantic analysis ran late may still require the use of CTFE built-ins to be evaluated. gcc/d/ChangeLog: * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Set doing_semantic_analysis_p before calling functionSemantic3. gcc/testsuite/ChangeLog: * gdc.dg/ctfeintrinsics.d: New test.
Diffstat (limited to 'gcc/testsuite/gdc.dg')
-rw-r--r--gcc/testsuite/gdc.dg/ctfeintrinsics.d53
1 files changed, 53 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.dg/ctfeintrinsics.d b/gcc/testsuite/gdc.dg/ctfeintrinsics.d
new file mode 100644
index 0000000..0e5592b
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/ctfeintrinsics.d
@@ -0,0 +1,53 @@
+// { dg-do compile { target d_runtime_has_std_library } }
+
+//////////////////////////////////////////////////////
+// std.math.exponential
+import std.math.exponential;
+
+enum test_exp = exp(1.0L);
+enum test_expm1 = expm1(1.0L);
+enum test_exp2 = exp2(1.0L);
+enum test_log = log(1.0L);
+enum test_log2 = log2(1.0L);
+enum test_log10 = log10(1.0L);
+enum test_pow = pow(1.0L, 1L);
+enum test_powi = pow(1L, 1L);
+enum test_powf = pow(1L, 1.0L);
+enum test_powl = pow(1.0L, 1.0L);
+
+//////////////////////////////////////////////////////
+// std.math.operations
+import std.math.operations;
+
+enum test_fmin = fmin(1.0L, 2.0L);
+enum test_fmax = fmax(1.0L, 2.0L);
+enum test_fma = fma(1.0L, 2.0L, 3.0L);
+
+//////////////////////////////////////////////////////
+// std.math.rounding
+import std.math.rounding;
+
+enum test_round = round(12.34L);
+enum test_floorf = floor(12.34f);
+enum test_floor = floor(12.34);
+enum test_floorl = floor(12.34L);
+enum test_ceilf = ceil(12.34f);
+enum test_ceil = ceil(12.34);
+enum test_ceill = ceil(12.34L);
+enum test_trunc = trunc(12.34L);
+
+//////////////////////////////////////////////////////
+// std.math.traits
+import std.math.traits;
+
+enum test_isNaN = isNaN(real.nan);
+enum test_isInfinity = isInfinity(real.infinity);
+enum test_isFinite = isFinite(1.0L);
+enum test_copysign = copysign(1.0L, -1.0L);
+enum test_copysigni = copysign(1L, -1.0L);
+
+//////////////////////////////////////////////////////
+// std.math.trigonometry
+import std.math.trigonometry;
+
+enum test_tan = tan(1.0L);