Skip to content

Merge upstream stable #4749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}