mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
fix Issue 21432 - [CTFE] Cannot declare enum array in function scope
This commit is contained in:
parent
3805e2973a
commit
2e40bf2fe2
2 changed files with 33 additions and 3 deletions
25
compiler/test/compilable/test21432.d
Normal file
25
compiler/test/compilable/test21432.d
Normal file
|
@ -0,0 +1,25 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=21432
|
||||
auto issue21432()
|
||||
{
|
||||
enum int[] a = [];
|
||||
return a;
|
||||
}
|
||||
|
||||
enum test21432a = issue21432;
|
||||
|
||||
///////////////////////
|
||||
|
||||
double issue21432b(double r)
|
||||
{
|
||||
enum double[4] poly = [
|
||||
0x1.ffffffffffdbdp-2,
|
||||
0x1.555555555543cp-3,
|
||||
0x1.55555cf172b91p-5,
|
||||
0x1.1111167a4d017p-7,
|
||||
];
|
||||
|
||||
immutable r2 = r * r;
|
||||
return r + r2 * (poly[0] + r * poly[1]) + r2 * r2 * (poly[2] + r * poly[3]);
|
||||
}
|
||||
|
||||
enum test21432b = issue21432b(-0x1p-1);
|
Loading…
Add table
Add a link
Reference in a new issue