// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. trait Unsigned { const MAX: u8; } struct U8(u8); impl Unsigned for U8 { const MAX: u8 = 0xff; } struct Sum(A,B); impl Unsigned for Sum { const MAX: u8 = A::MAX + B::MAX; } fn foo(_: T) -> &'static u8 { &Sum::::MAX //~ ERROR erroneous constant used //~| ERROR E0080 } fn main() { foo(0); }