Skip to content

Commit

Permalink
Merge pull request #4452 from 9rnsr/fix14235
Browse files Browse the repository at this point in the history
[REG2.066] Issue 14235 - full-qualified template instantiation misses its error location
  • Loading branch information
WalterBright authored and MartinNowak committed Mar 10, 2015
1 parent 18f4c44 commit 643ca3f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/dsymbol.c
Expand Up @@ -481,18 +481,18 @@ Dsymbol *Dsymbol::searchX(Loc loc, Scope *sc, RootObject *id)
{
sm = s->search_correct(ti->name);
if (sm)
error("template identifier '%s' is not a member of '%s %s', did you mean '%s %s'?",
ti->name->toChars(), s->kind(), s->toChars(), sm->kind(), sm->toChars());
::error(loc, "template identifier '%s' is not a member of '%s %s', did you mean '%s %s'?",
ti->name->toChars(), s->kind(), s->toPrettyChars(), sm->kind(), sm->toChars());
else
error("template identifier '%s' is not a member of '%s %s'",
ti->name->toChars(), s->kind(), s->toChars());
::error(loc, "template identifier '%s' is not a member of '%s %s'",
ti->name->toChars(), s->kind(), s->toPrettyChars());
return NULL;
}
sm = sm->toAlias();
TemplateDeclaration *td = sm->isTemplateDeclaration();
if (!td)
{
error("%s is not a template, it is a %s", ti->name->toChars(), sm->kind());
::error(loc, "%s.%s is not a template, it is a %s", s->toPrettyChars(), ti->name->toChars(), sm->kind());
return NULL;
}
ti->tempdecl = td;
Expand Down
13 changes: 13 additions & 0 deletions test/fail_compilation/diag14235.d
@@ -0,0 +1,13 @@
/*
TEST_OUTPUT:
---
fail_compilation/diag14235.d(11): Error: template identifier 'Undefined' is not a member of 'module imports.a14235'
fail_compilation/diag14235.d(12): Error: template identifier 'Something' is not a member of 'module imports.a14235', did you mean 'struct SomeThing(T...)'?
fail_compilation/diag14235.d(13): Error: imports.a14235.SomeClass is not a template, it is a class
---
*/

import imports.a14235;
imports.a14235.Undefined!Object a;
imports.a14235.Something!Object b;
imports.a14235.SomeClass!Object c;
7 changes: 7 additions & 0 deletions test/fail_compilation/imports/a14235.d
@@ -0,0 +1,7 @@
module imports.a14235;

struct SomeThing(T...)
{
}

class SomeClass {}

0 comments on commit 643ca3f

Please sign in to comment.