Files
carbon-lang/toolchain/check/testdata/namespace/fail_duplicate.carbon
T
Richard SmithandJon Ross-Perkins b01dfb3f93 Support for class definitions with static member functions. (#3305)
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>
2023-10-18 19:49:45 +00:00

34 lines
988 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
namespace Foo;
fn Foo.Baz() {
}
// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+6]]:14: ERROR: Redefinition of function Baz.
// CHECK:STDERR: fn Foo.Baz() {
// CHECK:STDERR: ^
// CHECK:STDERR: fail_duplicate.carbon:[[@LINE-6]]:1: Previous definition was here.
// CHECK:STDERR: fn Foo.Baz() {
// CHECK:STDERR: ^
fn Foo.Baz() {
}
// CHECK:STDOUT: file "fail_duplicate.carbon" {
// CHECK:STDOUT: %.loc7: <namespace> = namespace {.Baz = %Baz.loc9}
// CHECK:STDOUT: %Baz.loc9: <function> = fn_decl @Baz
// CHECK:STDOUT: %Baz.loc18: <function> = fn_decl @Baz
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Baz() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT:
// CHECK:STDOUT: !.loc19:
// CHECK:STDOUT: return
// CHECK:STDOUT: }