Files
carbon-lang/toolchain/check/testdata/class/forward_declared.carbon
T
Richard Smith 4e64b1948d Bare-bones support for forward-declared classes. (#3294)
This is mostly scaffolding, but is just about enough for pointers to
classes to work properly as types.
2023-10-13 21:29:50 +00:00

23 lines
688 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
//
// AUTOUPDATE
class Class;
fn F(p: Class*) -> Class* { return p; }
// CHECK:STDOUT: file "forward_declared.carbon" {
// CHECK:STDOUT: %Class: type = class_declaration @Class
// CHECK:STDOUT: %F: <function> = fn_decl @F
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @Class;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%p: Class*) -> Class* {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %p.ref: Class* = name_reference "p", %p
// CHECK:STDOUT: return %p.ref
// CHECK:STDOUT: }