Squashed 'dmd2/' changes from fc63fd3..82e6a91

82e6a91 Resolve rvalue reference on template function arguments
3708457 Implement rvalue reference for struct literal & construction
530a59f Revert "struct literals are lvalues again"
f199933 struct literals are lvalues again
5f181da better error message for Issue 7815 - Mixin template forward reference (?) regression
e5452d5 fix Issue 7888 - derivedMembers forward reference error with nested imports
b77ae4f merge with D1
5fed58d fix Issue 7886 - derivedMembers infinite recursion
0cf5ecd Merge pull request #872 from 9rnsr/fix7873
744f102 fix Issue 7695 - Regression(2.058): ICE(mtype.c) on associative array with keys of struct type with const members
80fc228 fix Issue 7873 - IFTI with inout does not properly match template parameter if called from inout function for pointers
4a5d365 fix CTFE bugs reported in beta
df22942 add kind()
d36a3b4 Merge pull request #871 from 9rnsr/fix7871
66d1302 fix Issue 7871 - RangeViolation with findSplitBefore
020ab91 fix Issue 7811 - "not a property" error instead of real error on UFCS array template property
c349458 fix Issue 7862 - Accepts-invalid template forward reference bug related to derivedMembers
00d8ec8 fix Issue 7861 - Segfault during __error propagation with self-referencing module
4c9652d fix fwd ref bug
477c357 fix Issue 7859 - Crash on invalid alias template parameter type
c35f67a fix Issue 7858 - __traits(getOverloads) returns incorrect symbol
bc840e8 fix Issue 7815 - Mixin template forward reference (?) regression
18a1485 fix auto test break
ceef368 fix Issue 7826 - [D2 Beta] Cannot use getHash in toHash without a warning
d747fd6 fix Issue 7820 - regression(DMD 2.059head) Wrong error on forward reference to 'front' with -property switch
1094601 fix Issue 7823 - Can't use a struct initializer to initialize a nested enum used as a default function argument initializer

git-subtree-dir: dmd2
git-subtree-split: 82e6a91f234843be7f660b242f8b8819c1eae20c
This commit is contained in:
Alexey Prokhin
2012-04-22 09:41:54 +04:00
parent bfad290036
commit eadd5fb645
16 changed files with 297 additions and 56 deletions

56
func.c
View File

@@ -156,6 +156,11 @@ void FuncDeclaration::semantic(Scope *sc)
semanticRun = PASSsemantic;
}
if (scope)
{ sc = scope;
scope = NULL;
}
unsigned dprogress_save = Module::dprogress;
foverrides.setDim(0); // reset in case semantic() is being retried for this function
@@ -2743,6 +2748,9 @@ int FuncDeclaration::isImportedSymbol()
int FuncDeclaration::isVirtual()
{
if (toAliasFunc() != this)
return toAliasFunc()->isVirtual();
Dsymbol *p = toParent();
#if 0
printf("FuncDeclaration::isVirtual(%s)\n", toChars());
@@ -2763,6 +2771,9 @@ int FuncDeclaration::isVirtual()
int FuncDeclaration::isVirtualMethod()
{
if (toAliasFunc() != this)
return toAliasFunc()->isVirtualMethod();
//printf("FuncDeclaration::isVirtualMethod() %s\n", toChars());
if (!isVirtual())
return 0;
@@ -2776,6 +2787,9 @@ int FuncDeclaration::isVirtualMethod()
int FuncDeclaration::isFinal()
{
if (toAliasFunc() != this)
return toAliasFunc()->isFinal();
ClassDeclaration *cd;
#if 0
printf("FuncDeclaration::isFinal(%s), %x\n", toChars(), Declaration::isFinal());
@@ -3285,6 +3299,11 @@ void CtorDeclaration::semantic(Scope *sc)
TypeFunction *tf = (TypeFunction *)type;
assert(tf && tf->ty == Tfunction);
if (scope)
{ sc = scope;
scope = NULL;
}
sc = sc->push();
sc->stc &= ~STCstatic; // not a static constructor
sc->flags |= SCOPEctor;
@@ -3403,6 +3422,10 @@ void PostBlitDeclaration::semantic(Scope *sc)
//printf("PostBlitDeclaration::semantic() %s\n", toChars());
//printf("ident: %s, %s, %p, %p\n", ident->toChars(), Id::dtor->toChars(), ident, Id::dtor);
//printf("stc = x%llx\n", sc->stc);
if (scope)
{ sc = scope;
scope = NULL;
}
parent = sc->parent;
Dsymbol *parent = toParent();
StructDeclaration *ad = parent->isStructDeclaration();
@@ -3476,6 +3499,10 @@ void DtorDeclaration::semantic(Scope *sc)
{
//printf("DtorDeclaration::semantic() %s\n", toChars());
//printf("ident: %s, %s, %p, %p\n", ident->toChars(), Id::dtor->toChars(), ident, Id::dtor);
if (scope)
{ sc = scope;
scope = NULL;
}
parent = sc->parent;
Dsymbol *parent = toParent();
AggregateDeclaration *ad = parent->isAggregateDeclaration();
@@ -3567,6 +3594,11 @@ void StaticCtorDeclaration::semantic(Scope *sc)
{
//printf("StaticCtorDeclaration::semantic()\n");
if (scope)
{ sc = scope;
scope = NULL;
}
if (!type)
type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);
@@ -3695,6 +3727,11 @@ Dsymbol *StaticDtorDeclaration::syntaxCopy(Dsymbol *s)
void StaticDtorDeclaration::semantic(Scope *sc)
{
if (scope)
{ sc = scope;
scope = NULL;
}
ClassDeclaration *cd = sc->scopesym->isClassDeclaration();
if (!type)
@@ -3822,6 +3859,10 @@ Dsymbol *InvariantDeclaration::syntaxCopy(Dsymbol *s)
void InvariantDeclaration::semantic(Scope *sc)
{
if (scope)
{ sc = scope;
scope = NULL;
}
parent = sc->parent;
Dsymbol *parent = toParent();
AggregateDeclaration *ad = parent->isAggregateDeclaration();
@@ -3902,6 +3943,11 @@ Dsymbol *UnitTestDeclaration::syntaxCopy(Dsymbol *s)
void UnitTestDeclaration::semantic(Scope *sc)
{
if (scope)
{ sc = scope;
scope = NULL;
}
if (global.params.useUnitTests)
{
if (!type)
@@ -3985,6 +4031,11 @@ void NewDeclaration::semantic(Scope *sc)
{
//printf("NewDeclaration::semantic()\n");
if (scope)
{ sc = scope;
scope = NULL;
}
parent = sc->parent;
Dsymbol *parent = toParent();
ClassDeclaration *cd = parent->isClassDeclaration();
@@ -4069,6 +4120,11 @@ void DeleteDeclaration::semantic(Scope *sc)
{
//printf("DeleteDeclaration::semantic()\n");
if (scope)
{ sc = scope;
scope = NULL;
}
parent = sc->parent;
Dsymbol *parent = toParent();
ClassDeclaration *cd = parent->isClassDeclaration();