d: Fix a couple of ICEs found in the dmd front-end (PR97842)
- Segmentation fault on incomplete static if. - Segmentation fault resolving typeof() expression when gagging is on. Reviewed-on: https://github.com/dlang/dmd/pull/11971 gcc/d/ChangeLog: PR d/97842 * dmd/MERGE: Merge upstream dmd b6a779e49
This commit is contained in:
parent
fa9091ad93
commit
27d8c3516b
|
@ -1,4 +1,4 @@
|
||||||
95044d8e45a4320f07d9c75b4eb30e55688a8195
|
b6a779e49a3bba8be6272e6730e14cbb6293ef77
|
||||||
|
|
||||||
The first line of this file holds the git revision number of the last
|
The first line of this file holds the git revision number of the last
|
||||||
merge done from the dlang/dmd repository.
|
merge done from the dlang/dmd repository.
|
||||||
|
|
|
@ -705,6 +705,10 @@ int StaticIfCondition::include(Scope *sc)
|
||||||
sc = sc->push(sc->scopesym);
|
sc = sc->push(sc->scopesym);
|
||||||
|
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
|
|
||||||
|
if (!exp)
|
||||||
|
goto Lerror;
|
||||||
|
|
||||||
bool result = evalStaticCondition(sc, exp, exp, errors);
|
bool result = evalStaticCondition(sc, exp, exp, errors);
|
||||||
sc->pop();
|
sc->pop();
|
||||||
|
|
||||||
|
|
|
@ -7418,6 +7418,12 @@ void TypeTypeof::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol
|
||||||
|
|
||||||
//printf("TypeTypeof::resolve(sc = %p, idents = '%s')\n", sc, toChars());
|
//printf("TypeTypeof::resolve(sc = %p, idents = '%s')\n", sc, toChars());
|
||||||
//static int nest; if (++nest == 50) *(char*)0=0;
|
//static int nest; if (++nest == 50) *(char*)0=0;
|
||||||
|
if (sc == NULL)
|
||||||
|
{
|
||||||
|
*pt = Type::terror;
|
||||||
|
error(loc, "Invalid scope.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (inuse)
|
if (inuse)
|
||||||
{
|
{
|
||||||
inuse = 2;
|
inuse = 2;
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
TEST_OUTPUT:
|
||||||
|
---
|
||||||
|
fail_compilation/fail18970.d(22): Error: no property `y` for type `fail18970.S`
|
||||||
|
fail_compilation/fail18970.d(29): Error: no property `yyy` for type `fail18970.S2`
|
||||||
|
---
|
||||||
|
*/
|
||||||
|
|
||||||
|
// https://issues.dlang.org/show_bug.cgi?id=18970
|
||||||
|
|
||||||
|
struct S
|
||||||
|
{
|
||||||
|
auto opDispatch(string name)(int)
|
||||||
|
{
|
||||||
|
alias T = typeof(x);
|
||||||
|
static assert(!is(T.U));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
S().y(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct S2
|
||||||
|
{
|
||||||
|
this(int)
|
||||||
|
{
|
||||||
|
this.yyy;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto opDispatch(string name)()
|
||||||
|
{
|
||||||
|
alias T = typeof(x);
|
||||||
|
static if(is(T.U)) {}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
struct D(E)
|
||||||
|
{
|
||||||
|
void G() {
|
||||||
|
import imports.test21164d;
|
||||||
|
I;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import imports.test21164c;
|
||||||
|
enum N = O();
|
||||||
|
alias Q = R!(N, S);
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
enum S = 1;
|
||||||
|
|
||||||
|
struct O
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
struct R(O U, int W)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
auto AB()
|
||||||
|
{
|
||||||
|
static if}
|
||||||
|
|
||||||
|
auto I()
|
||||||
|
{
|
||||||
|
AB;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
/*
|
||||||
|
TEST_OUTPUT:
|
||||||
|
---
|
||||||
|
fail_compilation/imports/test21164d.d(3): Error: (expression) expected following `static if`
|
||||||
|
fail_compilation/imports/test21164d.d(3): Error: found `}` instead of statement
|
||||||
|
fail_compilation/test21164.d(11): Error: template instance `test21164a.D!(R!(O(), 1))` error instantiating
|
||||||
|
---
|
||||||
|
*/
|
||||||
|
import imports.test21164a;
|
||||||
|
import imports.test21164b;
|
||||||
|
auto GB(D!Q)
|
||||||
|
{
|
||||||
|
}
|
Loading…
Reference in New Issue