Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Ticket #13 (closed defect: invalid)

Opened 13 years ago

Last modified 13 years ago

DCollections doesn't build when embedded in another project

Reported by: debio Assigned to: schveiguy
Priority: major Milestone: 2.0
Component: code Version: 2.0c
Keywords: Cc:

Description

I'm observing the strange behavior that DCollections will build into a library fine, but when I add the code to my codebase and try to build everything at once, I get this error:

/usr/include/d/std/conv.d(99): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S,T) && isSomeString!(T) && isInputRange!(Unqual!(S)) && isSomeChar!(ElementType!(S))) cannot deduce template function from argument types !(string)(I)
/usr/include/d/std/conv.d(99): Error: template instance errors instantiating template
/usr/include/d/std/conv.d(221): Error: template instance std.conv.to!(string).to!(I) error instantiating
/usr/include/d/std/conv.d(99):        instantiated from here: toImpl!(string,Stride!(I[]))
/usr/include/d/std/conv.d(3747):        instantiated from here: to!(Stride!(I[]))
/usr/include/d/std/conv.d(3763):        instantiated from here: textImpl!(string,Stride!(I[]))
/usr/include/d/std/range.d(5400):        instantiated from here: text!(Stride!(I[]))
/usr/include/d/std/algorithm.d(5910):        instantiated from here: SortedRange!(I[],comp)
src/dcollections/ArrayList.d(880):        instantiated from here: sort!(comp,cast(SwapStrategy)0,I[])
src/dcollections/ArrayList.d(1000):        instantiated from here: ArrayList!(I)

This is seen with DMD 2.052 built on Arch Linux x86-64 (multilib - I'm not generating 64 bit code (yet)) I'm working inside the DDT IDE, which is significant because it means DMD is only called once to build the executable - all source files are built in one invocation.

Change History

04/22/11 13:15:33 changed by schveiguy

  • status changed from new to closed.
  • resolution set to invalid.

This is actually an error in phobos. One that I thought I had fixed, but apparently there is a new issue.

Looking at the code, range.d line 5400 is in a debug clause. So this only happens when you pass -debug to the compiler. I'll generate a bugzilla entry, and close this one with a reference there.

In the meantime try replacing the line at range.d 5400 with this:

            static if(is(typeof(text(st))))
                assert(isSorted!pred(st), text(st));
            else
                assert(isSorted!pred(st));

The issue is, interfaces do not have a default toString, so instantiating an ArrayList? of interfaces fails when sort's debug code tries to assert and print the range.

04/22/11 13:25:14 changed by schveiguy