mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Set target in test.
This commit is contained in:
@@ -6370,10 +6370,11 @@ static inline bool sema_expr_analyse_access(SemaContext *context, Expr *expr, bo
|
||||
if (parent->expr_kind == EXPR_TYPEINFO)
|
||||
{
|
||||
Type *type = parent->type_expr->type->canonical;
|
||||
switch (type->type_kind)
|
||||
switch (type_no_optional(type)->type_kind)
|
||||
{
|
||||
case CT_TYPES:
|
||||
RETURN_SEMA_ERROR(parent, "You cannot take the typeid of a compile time type.");
|
||||
|
||||
default:
|
||||
expr_rewrite_const_typeid(expr, parent->type_expr->type->canonical);
|
||||
return true;
|
||||
@@ -12068,7 +12069,7 @@ static inline bool sema_cast_rvalue(SemaContext *context, Expr *expr, bool mutat
|
||||
}
|
||||
return true;
|
||||
case EXPR_TYPEINFO:
|
||||
switch (expr->type_expr->type->type_kind)
|
||||
switch (type_no_optional(expr->type_expr->type)->type_kind)
|
||||
{
|
||||
case CT_TYPES:
|
||||
RETURN_SEMA_ERROR(expr, "You cannot take the typeid of a compile time type.");
|
||||
|
||||
8
test/test_suite/compile_time/typeof_untyped.c3
Normal file
8
test/test_suite/compile_time/typeof_untyped.c3
Normal file
@@ -0,0 +1,8 @@
|
||||
macro test(x)
|
||||
{
|
||||
}
|
||||
fn int main()
|
||||
{
|
||||
test($typeof({})?); // #error: You cannot take the typeid of a compile time type
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user