gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Cannot parse disabled default const

Open P-E-P opened this issue 2 years ago • 0 comments

Compiler is emitting an error even if the code is disabled.

I tried this code:

fn main() {}

#[cfg(FALSE)]
trait T {
    default const X: u8;
}

I expected to see this happen: Compiles correctly.

Instead, this happened:

./test.rs:5:13: error: expecting ‘!’ but ‘const’ found
    5 |     default const X: u8;
      |             ^~~~~
./test.rs:5:13: error: failed to parse trait item in trait
./test.rs:5:13: error: failed to parse item in crate

https://godbolt.org/z/eP38brEKn

Meta

  • c7728c8020334fecb47789163ba94326aab6208c

P-E-P avatar Oct 08 '23 17:10 P-E-P