From a7882a8ae67d121d084689c5108cf6c847890655 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 15 Jun 2013 15:07:06 +0200 Subject: [PATCH] Fix another few issues caused by the upstream v2.063.1 retagging. --- dmd2/declaration.c | 16 +++++++++++++++- dmd2/expression.c | 2 ++ dmd2/mars.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dmd2/declaration.c b/dmd2/declaration.c index a8b602d3..a266be82 100644 --- a/dmd2/declaration.c +++ b/dmd2/declaration.c @@ -1220,7 +1220,7 @@ Lnomatch: AggregateDeclaration *aad = parent->isAggregateDeclaration(); if (aad) { -#if DMDV2 +#if PULL93 assert(!(storage_class & (STCextern | STCstatic | STCtls | STCgshared))); if (storage_class & (STCconst | STCimmutable) && init && global.params.vfield) @@ -1229,6 +1229,16 @@ Lnomatch: const char *s = (storage_class & STCimmutable) ? "immutable" : "const"; fprintf(stderr, "%s: %s.%s is %s field\n", p ? p : "", ad->toPrettyChars(), toChars(), s); } +#else + if (storage_class & (STCconst | STCimmutable) && init) + { + StorageClass stc = storage_class & (STCconst | STCimmutable); + warning(loc, "%s field with initializer should be static, __gshared, or an enum", + StorageClassDeclaration::stcToChars(NULL, stc)); + if (!tb->isTypeBasic()) + storage_class |= STCstatic; + } + else #endif { storage_class |= STCfield; @@ -1960,6 +1970,10 @@ AggregateDeclaration *VarDeclaration::isThis() if (!(storage_class & (STCstatic | STCextern | STCmanifest | STCtemplateparameter | STCtls | STCgshared | STCctfe))) { +#if !PULL93 + if ((storage_class & (STCconst | STCimmutable | STCwild)) && init) + return NULL; +#endif for (Dsymbol *s = this; s; s = s->parent) { ad = s->isMember(); diff --git a/dmd2/expression.c b/dmd2/expression.c index 822ed996..18406d87 100644 --- a/dmd2/expression.c +++ b/dmd2/expression.c @@ -7565,7 +7565,9 @@ Expression *DotVarExp::semantic(Scope *sc) accessCheck(loc, sc, e1, var); VarDeclaration *v = var->isVarDeclaration(); +#if PULL93 if (v && (v->isDataseg() || (v->storage_class & STCmanifest))) +#endif { Expression *e = expandVar(WANTvalue, v); if (e) diff --git a/dmd2/mars.h b/dmd2/mars.h index 1422d4db..1c641383 100644 --- a/dmd2/mars.h +++ b/dmd2/mars.h @@ -102,6 +102,7 @@ void unittests(); #define DMDV2 1 // Version 2.0 features #define SNAN_DEFAULT_INIT DMDV2 // if floats are default initialized to signalling NaN #define MODULEINFO_IS_STRUCT DMDV2 // if ModuleInfo is a struct rather than a class +#define PULL93 0 // controversial pull #93 for bugzilla 3449 // Set if C++ mangling is done by the front end #define CPP_MANGLE (DMDV2 && (TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || IN_LLVM))