mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
add compile error coverage for dependency loop
This commit is contained in:
parent
7b8a7989ef
commit
aacff8c800
@ -1,6 +1,8 @@
|
||||
pub const Foo = enum(c_int) {
|
||||
A = Foo.B,
|
||||
C = D,
|
||||
|
||||
pub const B = 0;
|
||||
};
|
||||
export fn entry() void {
|
||||
const s: Foo = Foo.E;
|
||||
@ -10,5 +12,4 @@ const D = 1;
|
||||
|
||||
// error
|
||||
//
|
||||
// :2:13: error: enum 'tmp.Foo' has no member named 'B'
|
||||
// :1:17: note: enum declared here
|
||||
// :1:5: error: dependency loop detected
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
pub const Foo = enum(c_int) {
|
||||
A = Foo.B,
|
||||
C = D,
|
||||
};
|
||||
export fn entry() void {
|
||||
const s: Foo = Foo.E;
|
||||
_ = s;
|
||||
}
|
||||
const D = 1;
|
||||
|
||||
// error
|
||||
// backend=stage2
|
||||
// target=native
|
||||
//
|
||||
// :2:13: error: enum 'tmp.Foo' has no member named 'B'
|
||||
// :1:17: note: enum declared here
|
||||
Loading…
x
Reference in New Issue
Block a user