mirror of
https://github.com/ziglang/zig.git
synced 2025-12-24 15:13:08 +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) {
|
pub const Foo = enum(c_int) {
|
||||||
A = Foo.B,
|
A = Foo.B,
|
||||||
C = D,
|
C = D,
|
||||||
|
|
||||||
|
pub const B = 0;
|
||||||
};
|
};
|
||||||
export fn entry() void {
|
export fn entry() void {
|
||||||
const s: Foo = Foo.E;
|
const s: Foo = Foo.E;
|
||||||
@ -10,5 +12,4 @@ const D = 1;
|
|||||||
|
|
||||||
// error
|
// error
|
||||||
//
|
//
|
||||||
// :2:13: error: enum 'tmp.Foo' has no member named 'B'
|
// :1:5: error: dependency loop detected
|
||||||
// :1:17: note: enum declared here
|
|
||||||
|
|||||||
@ -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