mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:30:12 +01:00
As a byproduct, this introduces a new top-level directory `integration_tests` for tests like this. This also fixes a latent bug with name mangling on Mac.
23 lines
510 B
Plaintext
23 lines
510 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
|
|
|
|
import Cpp library "<memory>";
|
|
|
|
class C {
|
|
fn C(i: i32) -> Self {
|
|
return {.i = i};
|
|
}
|
|
|
|
var i: i32;
|
|
}
|
|
|
|
fn Run() -> i32 {
|
|
var ptr: Cpp.std.unique_ptr(C) = Cpp.std.make_unique(C, 42);
|
|
if (not ptr.get().HasValue()) {
|
|
return 1;
|
|
}
|
|
let ref c: C = *ptr.get().Get();
|
|
return if c.i == 42 then 0 else 1;
|
|
}
|