diff --git a/src/class.c b/src/class.c index 9637725df884..3e7c97707ed7 100644 --- a/src/class.c +++ b/src/class.c @@ -795,14 +795,12 @@ void ClassDeclaration::semantic(Scope *sc) deferred->semantic3(sc); } -#if 0 if (type->ty == Tclass && ((TypeClass *)type)->sym != this) { - printf("this = %p %s\n", this, this->toChars()); - printf("type = %d sym = %p\n", type->ty, ((TypeClass *)type)->sym); + error("failed semantic analysis"); + this->errors = true; + type = Type::terror; } -#endif - assert(type->ty != Tclass || ((TypeClass *)type)->sym == this); } void ClassDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) @@ -1480,14 +1478,12 @@ void InterfaceDeclaration::semantic(Scope *sc) sc->pop(); //printf("-InterfaceDeclaration::semantic(%s), type = %p\n", toChars(), type); -#if 0 if (type->ty == Tclass && ((TypeClass *)type)->sym != this) { - printf("this = %p %s\n", this, this->toChars()); - printf("type = %d sym = %p\n", type->ty, ((TypeClass *)type)->sym); + error("failed semantic analysis"); + this->errors = true; + type = Type::terror; } -#endif - assert(type->ty != Tclass || ((TypeClass *)type)->sym == this); } diff --git a/src/struct.c b/src/struct.c index 4dea2f9c6be7..00919f32996d 100644 --- a/src/struct.c +++ b/src/struct.c @@ -858,6 +858,7 @@ void StructDeclaration::semantic(Scope *sc) if (global.errors != errors) { // The type is no good. type = Type::terror; + this->errors = true; } if (deferred && !global.gag) @@ -866,14 +867,12 @@ void StructDeclaration::semantic(Scope *sc) deferred->semantic3(sc); } -#if 0 if (type->ty == Tstruct && ((TypeStruct *)type)->sym != this) { - printf("this = %p %s\n", this, this->toChars()); - printf("type = %d sym = %p\n", type->ty, ((TypeStruct *)type)->sym); + error("failed semantic analysis"); + this->errors = true; + type = Type::terror; } -#endif - assert(type->ty != Tstruct || ((TypeStruct *)type)->sym == this); } Dsymbol *StructDeclaration::search(Loc loc, Identifier *ident, int flags) diff --git a/test/runnable/xtest46.d b/test/runnable/xtest46.d index e24478cf9f9b..46a145567152 100644 --- a/test/runnable/xtest46.d +++ b/test/runnable/xtest46.d @@ -6664,6 +6664,27 @@ void test7254() assert(bar7254(0) == "1234"); } +/***************************************************/ + +struct S11075() { int x = undefined_expr; } + +class C11075() { int x = undefined_expr; } + +interface I11075() { enum int x = undefined_expr; } + +void test11075() +{ + static assert(!is(typeof(S11075!().x))); + static assert(!is(typeof(S11075!().x))); + + static assert(!is(typeof(C11075!().x))); + static assert(!is(typeof(C11075!().x))); + + static assert(!is(typeof(I11075!().x))); + static assert(!is(typeof(I11075!().x))); +} + + /***************************************************/ int main() @@ -6940,6 +6961,7 @@ int main() test10539(); test10634(); test7254(); + test11075(); printf("Success\n"); return 0;