mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Restrict const expression usage to generic arguments
This commit is contained in:
parent
2b9443744b
commit
071dfa8e09
4 changed files with 19 additions and 3 deletions
|
@ -3868,6 +3868,13 @@ int BfResolvedTypeSet::DoHash(BfTypeReference* typeRef, LookupContext* ctx, BfHa
|
|||
}
|
||||
else if (auto constExprTypeRef = BfNodeDynCastExact<BfConstExprTypeRef>(typeRef))
|
||||
{
|
||||
if ((flags & BfHashFlag_AllowGenericParamConstValue) == 0)
|
||||
{
|
||||
ctx->mModule->Fail("Invalid use of const expression", constExprTypeRef->mConstToken);
|
||||
ctx->mFailed = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
BfVariant result;
|
||||
BfType* resultType = NULL;
|
||||
if (constExprTypeRef->mConstExpr != NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue