www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9861] New: Spurious 'is used as type' error with failed template instantiation

http://d.puremagic.com/issues/show_bug.cgi?id=9861

           Summary: Spurious 'is used as type' error with failed template
                    instantiation
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 02 2013