From 4e52281142c80230e1c60ece2824656dd08afcbd Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 24 Dec 2015 13:19:31 -0700 Subject: [PATCH] add test for error for redefinition of struct --- src/analyze.cpp | 1 - test/run_tests.cpp | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/analyze.cpp b/src/analyze.cpp index 448919e3c9716b46b608cb87b216b643f60e5dc7..3e990afac593312559d2f64df1f2d3552c481a76 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1066,7 +1066,6 @@ static TypeTableEntry *analyze_cast_expr(CodeGen *g, ImportTableEntry *import, B enum LValPurpose { LValPurposeAssign, LValPurposeAddressOf, - LValPurposeNotLVal, }; static TypeTableEntry *analyze_lvalue(CodeGen *g, ImportTableEntry *import, BlockContext *block_context, diff --git a/test/run_tests.cpp b/test/run_tests.cpp index bc04d3adcd9132386f76874cb4379e91370fd026..e2642d51281c8a7fe0bf6124a06f9aa48772de02 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -867,6 +867,11 @@ fn f() { )SOURCE", 2, ".tmp_source.zig:5:6: error: no member named 'foo' in 'A'", ".tmp_source.zig:6:16: error: no member named 'bar' in 'A'"); + + add_compile_fail_case("redefinition of struct", R"SOURCE( +struct A { x : i32, } +struct A { y : i32, } + )SOURCE", 1, ".tmp_source.zig:3:1: error: redefinition of 'A'"); } static void print_compiler_invocation(TestCase *test_case) { -- 2.54.0