Merge pull request #6103 from Vexu/extern

Disallow extern variables with initializers.
This commit is contained in:
Andrew Kelley
2020-08-20 18:35:31 -04:00
committed by GitHub
13 changed files with 121 additions and 32 deletions

View File

@@ -2,6 +2,12 @@ const tests = @import("tests.zig");
const std = @import("std");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.addTest("reject extern variables with initializers",
\\extern var foo: int = 2;
, &[_][]const u8{
"tmp.zig:1:1: error: extern variables have no initializers",
});
cases.addTest("duplicate/unused labels",
\\comptime {
\\ blk: { blk: while (false) {} }