Skip to content

$typeof(*x) should be valid when x is an [out] parameter #1226

@cbuttner

Description

@cbuttner

We run into this problem here:

/**
 * @param [out] x "The variable or dereferenced pointer to store to."
 * @param value "The value to store."
 * @param $alignment "The alignment to assume for the store"
 * @return "The value of x"
 *
 * @require $assignable(value, $typeof(*x)) : "The value doesn't match the variable"
                                       ^^
Error: 'out' parameters may not be read.
 * @require @constant_is_power_of_2($alignment) : "The alignment must be a power of two"
 **/
macro @unaligned_store(&x, value, usz $alignment) @builtin
{
	return $$unaligned_store(x, ($typeof(*x))value, $alignment);
}

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingFixed needs testingNeeds verification / testing that it now works

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions