Skip to content

Commit

Permalink
Fix bug 4269 case 13:invalid template accepted if evaluated while err…
Browse files Browse the repository at this point in the history
…ors are gagged

Need to ungag template declarations if they are forward referenced.
  • Loading branch information
don-clugston-sociomantic committed Dec 13, 2012
1 parent c4dc640 commit 2a1d419
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -5525,8 +5525,14 @@ TemplateDeclaration *TemplateInstance::findBestMatch(Scope *sc, Expressions *far
if (!td->semanticRun)
{
if (td->scope)
{ // Try to fix forward reference
{ // Try to fix forward reference. Ungag errors while doing so.
int oldgag = global.gag;
if (global.isSpeculativeGagging() && !td->isSpeculative())
global.gag = 0;

td->semantic(td->scope);

global.gag = oldgag;
}
if (!td->semanticRun)
{
Expand Down
4 changes: 4 additions & 0 deletions test/fail_compilation/gag4269g.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// REQUIRED_ARGS: -c -o-

static if(is(typeof(X13!(0).init))) {}
template X13(Y13 y) {}

0 comments on commit 2a1d419

Please sign in to comment.