From adebe4c732509ffdf7c0727eca176d86c22f4e90 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Mon, 13 Feb 2012 16:49:03 +0400 Subject: [PATCH] DMD Issue 4269 - Regression(2.031): invalid type accepted if evaluated while errors are gagged --- gen/declarations.cpp | 31 ++++++++++++++++++++++++++++++- gen/llvmhelpers.cpp | 4 ++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/gen/declarations.cpp b/gen/declarations.cpp index b3cd6f3a1e..b4c2a78a80 100644 --- a/gen/declarations.cpp +++ b/gen/declarations.cpp @@ -37,7 +37,11 @@ void Declaration::codegen(Ir*) void InterfaceDeclaration::codegen(Ir*) { - //Logger::println("Ignoring InterfaceDeclaration::toObjFile for %s", toChars()); + if (type->ty == Terror) + { error("had semantic errors when compiling"); + return; + } + if (members && symtab) DtoResolveDsymbol(this); } @@ -46,6 +50,11 @@ void InterfaceDeclaration::codegen(Ir*) void StructDeclaration::codegen(Ir*) { + if (type->ty == Terror) + { error("had semantic errors when compiling"); + return; + } + if (members && symtab) DtoResolveDsymbol(this); } @@ -54,6 +63,11 @@ void StructDeclaration::codegen(Ir*) void ClassDeclaration::codegen(Ir*) { + if (type->ty == Terror) + { error("had semantic errors when compiling"); + return; + } + if (members && symtab) DtoResolveDsymbol(this); } @@ -86,6 +100,11 @@ void VarDeclaration::codegen(Ir* p) Logger::print("VarDeclaration::toObjFile(): %s | %s\n", toChars(), type->toChars()); LOG_SCOPE; + if (type->ty == Terror) + { error("had semantic errors when compiling"); + return; + } + // just forward aliases if (aliassym) { @@ -187,6 +206,11 @@ void TypedefDeclaration::codegen(Ir*) Logger::print("TypedefDeclaration::toObjFile: %s\n", toChars()); LOG_SCOPE; + if (type->ty == Terror) + { error("had semantic errors when compiling"); + return; + } + // generate typeinfo DtoTypeInfoOf(type, false); } @@ -196,6 +220,11 @@ void TypedefDeclaration::codegen(Ir*) void EnumDeclaration::codegen(Ir*) { Logger::println("Ignoring EnumDeclaration::toObjFile for %s", toChars()); + + if (type->ty == Terror) + { error("had semantic errors when compiling"); + return; + } } /* ================================================================== */ diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index b17601c4fc..096331f3f0 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -912,8 +912,8 @@ void DtoResolveDsymbol(Dsymbol* dsym) DtoResolveTypeInfo(fd); } else { - error(dsym->loc, "unsupported dsymbol: %s", dsym->toChars()); - assert(0 && "unsupported dsymbol for DtoResolveDsymbol"); + error(dsym->loc, "unsupported dsymbol: %s", dsym->toChars()); + assert(0 && "unsupported dsymbol for DtoResolveDsymbol"); } }