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

[REG2.066] Issue 14235 - full-qualified template instantiation misses its error location #4452

Merged
merged 1 commit into from Mar 4, 2015
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
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 {}