Bug 9861 – Spurious 'is used as type' error with failed template instantiation
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-02T09:31:00Z
Last change time
2015-06-09T05:10:45Z
Keywords
diagnostic
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2013-04-02T09:31:23Z
struct Foo(T, real x = T.epsilon) { }
Foo!(int) q;
--
bug.d(1): Error: no property 'epsilon' for type 'int'
bug.d(2): Error: Foo!(int) is used as a type
Well, yeah, it's used as a type. It *is* a type!
Although it is helpful to be provided with the instantiation line number.
---
struct Bar(int x) {
somegarbage xxx;
}
Bar!(7).xxx p;
---
bug.d(2): Error: undefined identifier somegarbage
bug.d(4): Error: template instance junk.Bar!(7) error instantiating
bug.d(4): Error: Bar!(7).xxx is used as a type
And in this second case, the error message is entirely useless.
Comment #1 by yebblies — 2013-11-16T21:13:26Z
Seems to have been fixed at some point.
Comment #2 by github-bugzilla — 2013-11-18T08:42:15Z