Skip to content

Commit

Permalink
Merge pull request ldc-developers#4749 from kinke/merge_stable
Browse files Browse the repository at this point in the history
Merge upstream stable
  • Loading branch information
kinke authored Sep 8, 2024
2 parents d562736 + 9ce0aab commit 580ff68
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LDC master

#### Big news
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737)
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737, #4749)
- LLVM for prebuilt packages bumped to v18.1.8 (incl. macOS arm64). (#4712)
- Android: NDK for prebuilt package bumped from r26d to r27. (#4711)
- ldc2.conf: %%ldcconfigpath%% placeholder added - specifies the directory where current configuration file is located. (#4717)
Expand Down
4 changes: 3 additions & 1 deletion dmd/dtemplate.d
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,9 @@ MATCH deduceType(RootObject o, Scope* sc, Type tparam, ref TemplateParameters pa
edim = s ? getValue(s) : getValue(e);
}
}
if (tp && tp.matchArg(sc, t.dim, i, &parameters, dedtypes, null) || edim && edim.toInteger() == t.dim.toInteger())
if ((tp && tp.matchArg(sc, t.dim, i, &parameters, dedtypes, null)) ||
(edim && edim.isIntegerExp() && edim.toInteger() == t.dim.toInteger())
)
{
result = deduceType(t.next, sc, tparam.nextOf(), parameters, dedtypes, wm);
return;
Expand Down
2 changes: 1 addition & 1 deletion dmd/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ extern (C++) /* IN_LLVM abstract */ class Expression : ASTNode
dinteger_t toInteger()
{
//printf("Expression %s\n", EXPtoString(op).ptr);
if (!type.isTypeError())
if (!type || !type.isTypeError())
error(loc, "integer constant expression expected instead of `%s`", toChars());
return 0;
}
Expand Down
15 changes: 15 additions & 0 deletions tests/dmd/runnable/ifti.d
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ class Tst(TST, int v = 2) {

class Y : Tst!(float) {}

// https://issues.dlang.org/show_bug.cgi?id=24731
void test24731()
{
static int solve(size_t N)(ref double[N+1][N])
{
return N;
}

double[3][2] m;
assert(solve(m) == 2);
assert(solve!2(m) == 2);
}


void main() {
Tst!(int) t = new Tst!(int);
Y u = new Y;
Expand Down Expand Up @@ -113,4 +127,5 @@ void main() {
printf("%g\n", i);
}

test24731();
}

0 comments on commit 580ff68

Please sign in to comment.