D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5116 - spurious 'is used as a type' error after template lookup error
Summary: spurious 'is used as a type' error after template lookup error
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 minor
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-10-24 19:12 UTC by bearophile_hugs
Modified: 2015-06-09 05:11 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-10-24 19:12:00 UTC
This is a wrong D2 program:


struct Foo {}
class Bar(T) if (!is(T == struct)) {}
void main() {
    auto b = new Bar!Foo();
}


DMD 2.049 shows the following compile errors:

test.d(4): Error: template instance Bar!(Foo) does not match template declaration Bar(T) if (!is(T == struct))
test.d(4): Error: Bar!(Foo) is used as a type
test.d(4): Error: new can only create structs, dynamic arrays or class objects, not void's


But minimizing error messages noise is good to speed up debugging and to make coding simpler. So in this case I'd like to receive only the first error message.
Comment 1 Don 2012-02-24 00:34:50 UTC
Nothing to with templates. Same thing happens with:

struct Foo {}
class Bar(int n)
void main() {
    auto b = new Bar!Foo();
}
Comment 2 yebblies 2013-11-16 23:04:40 UTC
Appears to be fixed.