| // Copyright 2026 The Fuchsia Authors | |
| // | |
| // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 | |
| // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT | |
| // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. | |
| // This file may not be copied, modified, or distributed except according to | |
| // those terms. | |
| //! Rung 1 C++20 (`-fno-exceptions`) pipeline tests. | |
| use super::*; | |
| // ------------------- Rung 1: C++20 (-fno-exceptions) ------------------- | |
| fn body<'p>(p: &'p Program, symbol: &str) -> &'p anneal_lower_cpp::ir::Body { | |
| p.bodies.iter().find(|b| b.identity == symbol).unwrap_or_else(|| panic!("no body `{symbol}`")) | |
| } | |
| fn lower_ok(name: &str) -> Program { | |
| lower(name).unwrap_or_else(|e| panic!("{name}: {e}")) | |
| } | |
| #[track_caller] | |
| fn assert_unsupported_construct(name: &str) { | |
| match lower(name) { | |
| Err(LowerError::UnsupportedConstruct { .. }) => {} | |
| other => panic!("{name}: expected UnsupportedConstruct, got {other:?}"), | |
| } | |
| } | |
| #[path = "cxx/destructors_and_rejections.rs"] | |
| mod destructors_and_rejections; | |
| #[path = "cxx/lowering_and_abi.rs"] | |
| mod lowering_and_abi; | |
| #[test] | |
| fn cxx_instantiated_howmany_lowers_with_itanium_abi() { | |
| lowering_and_abi::cxx_instantiated_howmany_lowers_with_itanium_abi(); | |
| } | |
| #[test] | |
| fn cxx_roundup_calls_the_howmany_specialization() { | |
| lowering_and_abi::cxx_roundup_calls_the_howmany_specialization(); | |
| } | |
| #[test] | |
| fn cxx_bitmask_specialization_lowers() { | |
| lowering_and_abi::cxx_bitmask_specialization_lowers(); | |
| } | |
| #[test] | |
| fn cxx_guard_return_slot_is_initialized_before_the_destructor_runs() { | |
| lowering_and_abi::cxx_guard_return_slot_is_initialized_before_the_destructor_runs(); | |
| } | |
| #[test] | |
| fn cxx_std_bit_cast_style_template_binds_a_reference() { | |
| lowering_and_abi::cxx_std_bit_cast_style_template_binds_a_reference(); | |
| } | |
| #[test] | |
| fn cxx_packed_bitfield_descriptor_round_trips_through_bit_cast() { | |
| lowering_and_abi::cxx_packed_bitfield_descriptor_round_trips_through_bit_cast(); | |
| } | |
| #[test] | |
| fn cxx_span_constructor_methods_and_subscript_operator() { | |
| lowering_and_abi::cxx_span_constructor_methods_and_subscript_operator(); | |
| } | |
| #[test] | |
| fn cxx_requires_constrained_template_takes_a_slice_by_value() { | |
| lowering_and_abi::cxx_requires_constrained_template_takes_a_slice_by_value(); | |
| } | |
| #[test] | |
| fn cxx_references_lower_to_non_null_pointers() { | |
| lowering_and_abi::cxx_references_lower_to_non_null_pointers(); | |
| } | |
| #[test] | |
| fn cxx_constructor_initializers_and_member_calls() { | |
| destructors_and_rejections::cxx_constructor_initializers_and_member_calls(); | |
| } | |
| #[test] | |
| fn cxx_full_expression_temporary_is_destroyed_after_the_return_value() { | |
| destructors_and_rejections::cxx_full_expression_temporary_is_destroyed_after_the_return_value(); | |
| } | |
| #[test] | |
| fn cxx_break_runs_the_loop_scope_destructor() { | |
| destructors_and_rejections::cxx_break_runs_the_loop_scope_destructor(); | |
| } | |
| #[test] | |
| fn cxx_rejects_virtual_calls() { | |
| destructors_and_rejections::cxx_rejects_virtual_calls(); | |
| } | |
| #[test] | |
| fn cxx_rejects_exceptions() { | |
| destructors_and_rejections::cxx_rejects_exceptions(); | |
| } | |
| #[test] | |
| fn cxx_rejects_unsequenced_constructor_arguments() { | |
| destructors_and_rejections::cxx_rejects_unsequenced_constructor_arguments(); | |
| } | |
| #[test] | |
| fn cxx_rejects_dialects_outside_rung1() { | |
| destructors_and_rejections::cxx_rejects_dialects_outside_rung1(); | |
| } | |
| #[test] | |
| fn cxx_rejects_undeclared_destructors() { | |
| destructors_and_rejections::cxx_rejects_undeclared_destructors(); | |
| } | |
| #[test] | |
| fn cxx_lean_rendering_uses_the_new_constructors() { | |
| destructors_and_rejections::cxx_lean_rendering_uses_the_new_constructors(); | |
| } | |
| #[test] | |
| fn cxx_clobbering_destructor_runs_after_the_return_value_is_captured() { | |
| destructors_and_rejections::cxx_clobbering_destructor_runs_after_the_return_value_is_captured(); | |
| } |