Broken cast from fault to array pointer #2778.

This commit is contained in:
Christoffer Lerno
2026-01-20 17:43:16 +01:00
parent 9c435352b9
commit d7bfddf35e
3 changed files with 11 additions and 1 deletions

View File

@@ -22,6 +22,7 @@
- Deprecated use of `?` to create optional. - Deprecated use of `?` to create optional.
- Vectors not converted to arrays when passed as raw vaargs. #2776 - Vectors not converted to arrays when passed as raw vaargs. #2776
- Second value in switch range not checked properly, causing an error on non-const values. #2777 - Second value in switch range not checked properly, causing an error on non-const values. #2777
- Broken cast from fault to array pointer #2778.
### Fixes ### Fixes
- Regression with npot vector in struct triggering an assert #2219. - Regression with npot vector in struct triggering an assert #2219.

View File

@@ -2609,7 +2609,7 @@ CastFunction cast_function[CONV_LAST + 1][CONV_LAST + 1] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // CONST ENUM { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // CONST ENUM
{XX2VO, 0, PT2BO, PT2IN, 0, 0, 0, EX2VC, 0, 0, 0, 0, 0, 0, 0, 0, 0, PT2PT, 0, 0, PT2PT, 0, 0, 0 }, // FUNC {XX2VO, 0, PT2BO, PT2IN, 0, 0, 0, EX2VC, 0, 0, 0, 0, 0, 0, 0, 0, 0, PT2PT, 0, 0, PT2PT, 0, 0, 0 }, // FUNC
{XX2VO, 0, TI2BO, TI2IN, 0, TI2PT, 0, EX2VC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TI2PT, TI2PT, 0, 0 }, // TYPEID {XX2VO, 0, TI2BO, TI2IN, 0, TI2PT, 0, EX2VC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TI2PT, TI2PT, 0, 0 }, // TYPEID
{XX2VO, 0, AF2BO, FA2IN, 0, FA2PT, 0, EX2VC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FA2IN, FA2IN, 0, 0 }, // ANYFAULT {XX2VO, 0, AF2BO, FA2IN, 0, FA2PT, 0, EX2VC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FA2PT, FA2PT, 0, 0 }, // ANYFAULT
{XX2VO, 0, PT2BO, PT2IN, 0, PT2PT, 0, EX2VC, 0, 0, 0, 0, 0, PT2AY, PT2AY, 0, 0, PT2PT, 0, 0, 0, PT2PT, 0, 0 }, // VOIDPTR {XX2VO, 0, PT2BO, PT2IN, 0, PT2PT, 0, EX2VC, 0, 0, 0, 0, 0, PT2AY, PT2AY, 0, 0, PT2PT, 0, 0, 0, PT2PT, 0, 0 }, // VOIDPTR
{XX2VO, 0, PT2BO, PT2IN, 0, PT2PT, AP2SL, EX2VC, 0, 0, 0, 0, 0, PT2AY, PT2AY, 0, 0, 0, 0, 0, PT2PT, PT2PT, PT2FE, 0 }, // ARRAYPTR {XX2VO, 0, PT2BO, PT2IN, 0, PT2PT, AP2SL, EX2VC, 0, 0, 0, 0, 0, PT2AY, PT2AY, 0, 0, 0, 0, 0, PT2PT, PT2PT, PT2FE, 0 }, // ARRAYPTR
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // INFERRED { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // INFERRED

View File

@@ -0,0 +1,9 @@
// #target: linux-x64
import libc;
fn void a()
{
fault x = f; // #error: 'f' could not be found
ulong z = (ulong); // #error: Implicitly casting 'typeid' to 'ulong' is not permitted
z = (Sigset_t*)(x); // #error: Implicitly casting 'Sigset_t*' (ulong[16]*) to 'ulong'
}