Skip to content
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

fix issue 19950 - access violation at compile time, possibly via template constraint and alias interaction #10195

Merged
merged 1 commit into from Jul 19, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/dmd/dtemplate.d
Expand Up @@ -962,12 +962,9 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
tf.fargs = fargs;
uint olderrors = global.startGagging();
fd.type = tf.typeSemantic(loc, paramscope);
if (global.endGagging(olderrors))
{
assert(fd.type.ty != Tfunction);
global.endGagging(olderrors);
if (fd.type.ty != Tfunction)
goto Lnomatch;
}
assert(fd.type.ty == Tfunction);
fd.originalType = fd.type; // for mangling
}

Expand Down
13 changes: 13 additions & 0 deletions test/fail_compilation/ice19950.d
@@ -0,0 +1,13 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice19950.d(8): Error: undefined identifier `NotHere`
fail_compilation/ice19950.d(9): Error: template instance `ice19950.baz!()` does not match template declaration `baz()(Foo) if (true)`
---
*/
alias Foo = NotHere;
alias Bar = baz!();

void baz()(Foo)
if (true)
{}