mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-23 17:02:39 +00:00
This includes being able to define a class that was previously forward-declared, and being able to define a member function out-of-line that was previously declared inside a class. No support for fields or methods yet, and a class definition doesn't yet cause the class to be treated as a complete type. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
23 lines
692 B
Plaintext
23 lines
692 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: }
|