Bug 5116 – spurious 'is used as a type' error after template lookup error
Status
RESOLVED
Resolution
WORKSFORME
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-10-24T19:12:00Z
Last change time
2015-06-09T05:11:42Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2010-10-24T19:12:00Z
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 by clugdbug — 2012-02-24T00:34:50Z
Nothing to with templates. Same thing happens with:
struct Foo {}
class Bar(int n)
void main() {
auto b = new Bar!Foo();
}