[Issue 11344] New: Error: object.destroy called with argument types matches both

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 24 12:58:08 PDT 2013


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

           Summary: Error: object.destroy called with argument types
                    matches both
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: rswhite4 at googlemail.com


--- Comment #0 from rswhite4 at googlemail.com 2013-10-24 12:58:07 PDT ---
Code:
----
import std.stdio;

struct vec2f {
public:
    float[2] values;

    alias values this;
}

struct array(T) {
public:
    T* ptr;
    size_t length;

    ~this() {
        static if (is(T == struct) || is(T == class)) {
            foreach (ref T item; this.ptr[0 .. this.length]) {
                .destroy!T(item);
            }
        }
    }
}

void main() {
    array!vec2f foo;
}
----

C:\Users\Besitzer\D\destroy_bug.d(18): Error: object.destroy called with
argument types (vec2f) matches both:
    D:\D\dmd2\windows\bin\..\..\src\druntime\import\object.di(513):
destroy(T)(ref T obj) if (is(T == struct))
and:
    D:\D\dmd2\windows\bin\..\..\src\druntime\import\object.di(524): destroy(T :
U[n], U, uint n)(ref T obj)
C:\Users\Besitzer\D\destroy_bug.d(25): Error: template instance
destroy_bug.array!(vec2f) error instantiating


Tested with the latest beta.
Worked in dmd 2.063.2

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


More information about the Digitalmars-d-bugs mailing list