gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

ICE when compiling macro in nested module architecture

Open CohenArthur opened this issue 3 years ago • 1 comments

mod foo {
    mod bar {
        mod baz {
            macro_rules! baz {
                () => {{}};
            }
        }
    }

    macro_rules! foo {
        () => {{}};
    }

    fn foo_f() {
        foo!();
    }

    fn bar_f() {
        baz!();
    }
}

CohenArthur avatar Sep 13 '22 14:09 CohenArthur

Another similar error:

mod foo {
    #[macro_export]
    macro_rules! bar1 {
        () => {};
    }

    macro_rules! bar2 {
        () => {};
    }
}

fn main() {
    bar1!();
    bar2!(); // { dg-error "cannot find macro .bar2. in this scope" }
}

CohenArthur avatar Sep 13 '22 15:09 CohenArthur