mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-14 11:53:13 +01:00
Merge of v2.063.2
This commit is contained in:
@@ -1793,15 +1793,15 @@ Expression *FuncExp::castTo(Scope *sc, Type *t)
|
||||
if (e)
|
||||
{
|
||||
if (e != this)
|
||||
e = e->castTo(sc, t);
|
||||
else if (!e->type->equals(t))
|
||||
return e->castTo(sc, t);
|
||||
if (!e->type->equals(t) && e->type->implicitConvTo(t))
|
||||
{
|
||||
assert(t->ty == Tpointer && t->nextOf()->ty == Tvoid || // Bugzilla 9928
|
||||
e->type->nextOf()->covariant(t->nextOf()) == 1);
|
||||
e = e->copy();
|
||||
e->type = t;
|
||||
return e;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
return Expression::castTo(sc, t);
|
||||
}
|
||||
|
||||
@@ -8412,6 +8412,8 @@ Lagain:
|
||||
{
|
||||
e1 = new DotVarExp(loc, dte->e1, f);
|
||||
e1 = e1->semantic(sc);
|
||||
if (e1->op == TOKerror)
|
||||
return new ErrorExp();
|
||||
ue = (UnaExp *)e1;
|
||||
}
|
||||
#if 0
|
||||
@@ -8872,31 +8874,34 @@ Expression *AddrExp::semantic(Scope *sc)
|
||||
{
|
||||
DotTemplateInstanceExp* dti = (DotTemplateInstanceExp *)e1;
|
||||
TemplateInstance *ti = dti->ti;
|
||||
assert(!ti->semanticRun);
|
||||
//assert(ti->needsTypeInference(sc));
|
||||
ti->semantic(sc);
|
||||
if (!ti->inst) // if template failed to expand
|
||||
return new ErrorExp;
|
||||
Dsymbol *s = ti->inst->toAlias();
|
||||
FuncDeclaration *f = s->isFuncDeclaration();
|
||||
assert(f);
|
||||
e1 = new DotVarExp(e1->loc, dti->e1, f);
|
||||
e1 = e1->semantic(sc);
|
||||
if (!ti->semanticRun)
|
||||
{
|
||||
//assert(ti->needsTypeInference(sc));
|
||||
ti->semantic(sc);
|
||||
if (!ti->inst) // if template failed to expand
|
||||
return new ErrorExp;
|
||||
Dsymbol *s = ti->inst->toAlias();
|
||||
FuncDeclaration *f = s->isFuncDeclaration();
|
||||
assert(f);
|
||||
e1 = new DotVarExp(e1->loc, dti->e1, f);
|
||||
e1 = e1->semantic(sc);
|
||||
}
|
||||
}
|
||||
else if (e1->op == TOKimport &&
|
||||
((ScopeExp *)e1)->sds->isTemplateInstance())
|
||||
else if (e1->op == TOKimport)
|
||||
{
|
||||
TemplateInstance *ti = (TemplateInstance *)((ScopeExp *)e1)->sds;
|
||||
assert(!ti->semanticRun);
|
||||
//assert(ti->needsTypeInference(sc));
|
||||
ti->semantic(sc);
|
||||
if (!ti->inst) // if template failed to expand
|
||||
return new ErrorExp;
|
||||
Dsymbol *s = ti->inst->toAlias();
|
||||
FuncDeclaration *f = s->isFuncDeclaration();
|
||||
assert(f);
|
||||
e1 = new VarExp(e1->loc, f);
|
||||
e1 = e1->semantic(sc);
|
||||
TemplateInstance *ti = ((ScopeExp *)e1)->sds->isTemplateInstance();
|
||||
if (ti && !ti->semanticRun)
|
||||
{
|
||||
//assert(ti->needsTypeInference(sc));
|
||||
ti->semantic(sc);
|
||||
if (!ti->inst) // if template failed to expand
|
||||
return new ErrorExp;
|
||||
Dsymbol *s = ti->inst->toAlias();
|
||||
FuncDeclaration *f = s->isFuncDeclaration();
|
||||
assert(f);
|
||||
e1 = new VarExp(e1->loc, f);
|
||||
e1 = e1->semantic(sc);
|
||||
}
|
||||
}
|
||||
e1 = e1->toLvalue(sc, NULL);
|
||||
if (e1->op == TOKerror)
|
||||
@@ -11099,7 +11104,7 @@ Ltupleassign:
|
||||
// Disallow sa = e (Converted to sa[] = e)
|
||||
const char* e1str = e1->toChars();
|
||||
const char* e2str = e2->toChars();
|
||||
if (e2->op == TOKslice || t2->implicitConvTo(t1->nextOf()))
|
||||
if (e2->op == TOKslice || e2->implicitConvTo(t1->nextOf()))
|
||||
warning("explicit element-wise assignment (%s)[] = %s is better than %s = %s",
|
||||
e1str, e2str, e1str, e2str);
|
||||
else
|
||||
|
||||
@@ -692,6 +692,7 @@ void Lexer::scan(Token *t)
|
||||
else if (id == Id::VERSIONX)
|
||||
{ unsigned major = 0;
|
||||
unsigned minor = 0;
|
||||
bool point = false;
|
||||
|
||||
for (const char *p = global.version + 1; 1; p++)
|
||||
{
|
||||
@@ -699,7 +700,11 @@ void Lexer::scan(Token *t)
|
||||
if (isdigit((unsigned char)c))
|
||||
minor = minor * 10 + c - '0';
|
||||
else if (c == '.')
|
||||
{ major = minor;
|
||||
{
|
||||
if (point)
|
||||
break; // ignore everything after second '.'
|
||||
point = true;
|
||||
major = minor;
|
||||
minor = 0;
|
||||
}
|
||||
else
|
||||
|
||||
14
dmd2/mars.c
14
dmd2/mars.c
@@ -1,6 +1,5 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2012 by Digital Mars
|
||||
// Copyright (c) 1999-2013 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -94,7 +93,7 @@ void Global::init()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
copyright = "Copyright (c) 1999-2012 by Digital Mars";
|
||||
copyright = "Copyright (c) 1999-2013 by Digital Mars";
|
||||
written = "written by Walter Bright";
|
||||
#if IN_DMD
|
||||
version = "v"
|
||||
@@ -626,11 +625,18 @@ int tryMain(size_t argc, char *argv[])
|
||||
{
|
||||
if (strcmp(p + 12, "?") == 0)
|
||||
{
|
||||
#if PULL93
|
||||
printf("\
|
||||
Language changes listed by -transition=id:\n\
|
||||
=field,3449 do list all non-mutable fields occupies object instance\n\
|
||||
=tls do list all variables going into thread local storage\n\
|
||||
");
|
||||
#else
|
||||
printf("\
|
||||
Language changes listed by -transition=id:\n\
|
||||
=tls do list all variables going into thread local storage\n\
|
||||
");
|
||||
#endif
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (isdigit((unsigned char)p[12]))
|
||||
@@ -653,8 +659,10 @@ Language changes listed by -transition=id:\n\
|
||||
{
|
||||
if (strcmp(p + 12, "tls") == 0)
|
||||
global.params.vtls = 1;
|
||||
#if PULL93
|
||||
else if (strcmp(p + 12, "field") == 0)
|
||||
global.params.vfield = 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
goto Lerror;
|
||||
|
||||
@@ -5499,11 +5499,11 @@ void TemplateInstance::semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int f
|
||||
{
|
||||
VarDeclaration *v;
|
||||
if (ea->op == TOKvar && (v = ((VarExp *)ea)->var->isVarDeclaration()) != NULL &&
|
||||
v->storage_class & STCmanifest && !(v->storage_class & STCtemplateparameter))
|
||||
!(v->storage_class & STCtemplateparameter))
|
||||
{
|
||||
if (v->sem < SemanticDone)
|
||||
v->semantic(sc);
|
||||
// skip optimization for manifest constant
|
||||
// skip optimization for variable symbols
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -440,6 +440,12 @@ Expression *TraitsExp::semantic(Scope *sc)
|
||||
Dsymbol *s = getDsymbol(o);
|
||||
if (!s)
|
||||
{
|
||||
#if 0
|
||||
Expression *e = isExpression(o);
|
||||
Type *t = isType(o);
|
||||
if (e) printf("e = %s %s\n", Token::toChars(e->op), e->toChars());
|
||||
if (t) printf("t = %d %s\n", t->ty, t->toChars());
|
||||
#endif
|
||||
error("first argument is not a symbol");
|
||||
goto Lfalse;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user