From 3bd5cf70c2147ad994394094237e63c4196aacc8 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Mon, 27 Apr 2009 01:43:29 +0200 Subject: [PATCH] Added testcase for overlapping struct default initializer I has missed. Slight tweak of the relevant error message. --- ir/irtypestruct.cpp | 2 +- tests/mini/nocompile_initoverlap2.d | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/mini/nocompile_initoverlap2.d diff --git a/ir/irtypestruct.cpp b/ir/irtypestruct.cpp index 6c2b2af6..e21fd0f9 100644 --- a/ir/irtypestruct.cpp +++ b/ir/irtypestruct.cpp @@ -110,7 +110,7 @@ const llvm::Type* IrTypeStruct::buildType() if (v_begin >= f_end || v_end <= f_begin) continue; - sd->error(vd->loc, "overlapping initialization for %s and %s", + sd->error(vd->loc, "has overlapping initialization for %s and %s", field_it->toChars(), vd->toChars()); } } diff --git a/tests/mini/nocompile_initoverlap2.d b/tests/mini/nocompile_initoverlap2.d new file mode 100644 index 00000000..334367cc --- /dev/null +++ b/tests/mini/nocompile_initoverlap2.d @@ -0,0 +1,8 @@ +struct S +{ + union + { + float f = 1; + int i = 2; + } +}