1
Fork 0
rust/src/test/ui/const-generics/defaults/complex-generic-default-expr.rs

15 lines
560 B
Rust
Raw Normal View History

// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![feature(const_generics_defaults)]
2021-04-18 13:57:22 +02:00
#![allow(incomplete_features)]
struct Foo<const N: usize, const M: usize = { N + 1 }>;
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters may not be used in const operations
2021-04-18 13:57:22 +02:00
struct Bar<T, const TYPE_SIZE: usize = { std::mem::size_of::<T>() }>(T);
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters may not be used in const operations
2021-04-18 13:57:22 +02:00
fn main() {}