mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-07 12:48:30 +00:00
24 lines
366 B
Rust
24 lines
366 B
Rust
//@ build-fail
|
|
//@ revisions: direct indirect
|
|
|
|
#![feature(default_field_values)]
|
|
|
|
struct Z<const X: usize> {
|
|
post_mono: usize = X / 0,
|
|
//~^ ERROR attempt to divide `1_usize` by zero
|
|
}
|
|
|
|
fn indirect<const X: usize>() {
|
|
let x: Z<X> = Z { .. };
|
|
}
|
|
|
|
#[cfg(direct)]
|
|
fn main() {
|
|
let x: Z<1> = Z { .. };
|
|
}
|
|
|
|
#[cfg(indirect)]
|
|
fn main() {
|
|
indirect::<1>();
|
|
}
|