Mercurial > projects > ldc
comparison dmd/declaration.c @ 1621:fb2e6707ad17
Merge DMD r314+r315: bugzilla 2029 Typesafe variadic functions don't...
Both DMD revisions are for fixing bugzilla 2029 (Typesafe variadic
functions don't work in CTFE).
The DMD r314 commit message is:
bugzilla 2029 (Typesafe variadic functions don't work in CTFE
The DMD r315 commit message is:
bugzilla 2029 - try again
---
dmd/constfold.c | 11 ++++-
dmd/declaration.c | 21 +++++++++-
dmd/declaration.h | 10 ++++-
dmd/expression.c | 1 +
dmd/interpret.c | 111 +++++++++++++++++++++++++++++++++++++++++++++--------
dmd/mars.h | 2 +-
dmd/mtype.c | 2 +-
7 files changed, 135 insertions(+), 23 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:22 -0300 |
parents | c61782a76dff |
children | 44b145be2ef5 |
comparison
equal
deleted
inserted
replaced
1620:0333945a915e | 1621:fb2e6707ad17 |
---|---|
307 //printf("TypedefDeclaration::semantic(%s) sem = %d\n", toChars(), sem); | 307 //printf("TypedefDeclaration::semantic(%s) sem = %d\n", toChars(), sem); |
308 if (sem == 0) | 308 if (sem == 0) |
309 { sem = 1; | 309 { sem = 1; |
310 basetype = basetype->semantic(loc, sc); | 310 basetype = basetype->semantic(loc, sc); |
311 sem = 2; | 311 sem = 2; |
312 #if DMDV2 | |
313 type = type->addStorageClass(storage_class); | |
314 #endif | |
312 type = type->semantic(loc, sc); | 315 type = type->semantic(loc, sc); |
313 if (sc->parent->isFuncDeclaration() && init) | 316 if (sc->parent->isFuncDeclaration() && init) |
314 semantic2(sc); | 317 semantic2(sc); |
315 storage_class |= sc->stc & STCdeprecated; | 318 storage_class |= sc->stc & STCdeprecated; |
316 } | 319 } |
439 aliassym->semantic(sc); | 442 aliassym->semantic(sc); |
440 return; | 443 return; |
441 } | 444 } |
442 this->inSemantic = 1; | 445 this->inSemantic = 1; |
443 | 446 |
447 #if DMDV1 // don't really know why this is here | |
444 if (storage_class & STCconst) | 448 if (storage_class & STCconst) |
445 error("cannot be const"); | 449 error("cannot be const"); |
450 #endif | |
446 | 451 |
447 storage_class |= sc->stc & STCdeprecated; | 452 storage_class |= sc->stc & STCdeprecated; |
448 | 453 |
449 // Given: | 454 // Given: |
450 // alias foo.bar.abc def; | 455 // alias foo.bar.abc def; |
471 #endif | 476 #endif |
472 ) | 477 ) |
473 goto L2; // it's a symbolic alias | 478 goto L2; // it's a symbolic alias |
474 | 479 |
475 #if DMDV2 | 480 #if DMDV2 |
481 type = type->addStorageClass(storage_class); | |
476 if (storage_class & (STCref | STCnothrow | STCpure)) | 482 if (storage_class & (STCref | STCnothrow | STCpure)) |
477 { // For 'ref' to be attached to function types, and picked | 483 { // For 'ref' to be attached to function types, and picked |
478 // up by Type::resolve(), it has to go into sc. | 484 // up by Type::resolve(), it has to go into sc. |
479 sc = sc->push(); | 485 sc = sc->push(); |
480 sc->stc |= storage_class & (STCref | STCnothrow | STCpure); | 486 sc->stc |= storage_class & (STCref | STCnothrow | STCpure | STCshared); |
481 type->resolve(loc, sc, &e, &t, &s); | 487 type->resolve(loc, sc, &e, &t, &s); |
482 sc = sc->pop(); | 488 sc = sc->pop(); |
483 } | 489 } |
484 else | 490 else |
485 #endif | 491 #endif |
1339 | 1345 |
1340 int VarDeclaration::isDataseg() | 1346 int VarDeclaration::isDataseg() |
1341 { | 1347 { |
1342 #if 0 | 1348 #if 0 |
1343 printf("VarDeclaration::isDataseg(%p, '%s')\n", this, toChars()); | 1349 printf("VarDeclaration::isDataseg(%p, '%s')\n", this, toChars()); |
1344 printf("%x, %p, %p\n", storage_class & (STCstatic | STCconst), parent->isModule(), parent->isTemplateInstance()); | 1350 printf("%llx, %p, %p\n", storage_class & (STCstatic | STCconst), parent->isModule(), parent->isTemplateInstance()); |
1345 printf("parent = '%s'\n", parent->toChars()); | 1351 printf("parent = '%s'\n", parent->toChars()); |
1346 #endif | 1352 #endif |
1347 Dsymbol *parent = this->toParent(); | 1353 Dsymbol *parent = this->toParent(); |
1348 if (!parent && !(storage_class & (STCstatic | STCconst))) | 1354 if (!parent && !(storage_class & (STCstatic | STCconst))) |
1349 { error("forward referenced"); | 1355 { error("forward referenced"); |
1360 */ | 1366 */ |
1361 | 1367 |
1362 int VarDeclaration::isThreadlocal() | 1368 int VarDeclaration::isThreadlocal() |
1363 { | 1369 { |
1364 return 0; | 1370 return 0; |
1371 } | |
1372 | |
1373 /******************************************** | |
1374 * Can variable be read and written by CTFE? | |
1375 */ | |
1376 | |
1377 int VarDeclaration::isCTFE() | |
1378 { | |
1379 //printf("VarDeclaration::isCTFE(%p, '%s')\n", this, toChars()); | |
1380 //printf("%llx\n", storage_class); | |
1381 return (storage_class & STCctfe) || !isDataseg(); | |
1365 } | 1382 } |
1366 | 1383 |
1367 int VarDeclaration::hasPointers() | 1384 int VarDeclaration::hasPointers() |
1368 { | 1385 { |
1369 //printf("VarDeclaration::hasPointers() %s, ty = %d\n", toChars(), type->ty); | 1386 //printf("VarDeclaration::hasPointers() %s, ty = %d\n", toChars(), type->ty); |