Files
carbon-lang/executable_semantics/testdata/star.carbon
T
Richard SmithandGeoff Romer 89e21113c3 Add 3 '*' operators: one prefix, one infix, and one postfix, per #523. (#582)
The presence or absence of whitespace is used to determine which
operator is in use, following the rules described in #520.

Support for prefix * dereference operator follows #523.

Co-authored-by: Geoff Romer <gromer@google.com>
2021-06-21 17:09:34 -07:00

17 lines
436 B
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Never actually called, so this only tests typechecking and semantic analysis.
fn F(n: Int, p: Int*, q: Int***) -> Int* {
var a: Int = n * *p;
var b: Int = a*n;
*p = b*(*p);
**q = p;
return **q;
}
fn main() -> Int {
return 0;
}