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

           Summary: Structs with non-const destructors cannot be used as
                    const parameters
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2010-06-17 00:03:49 PDT ---
TEST CASE:
struct A {
    ~this() {}
}

void foo(const A a) {}
---------
bug.d(4): Error: destructor bug.A.~this () is not callable using argument types
()

Workaround is to change ~this() into const ~this().

I find this whole situation pretty weird.  How can a destructor be const? (Is a
const struct effectively 'tail const', so that a const destructor only destroys
the non-const bit?) 
And anyway, should a destructor be called on non-mutable function parameters?
In any case, the error message is rather poor.

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

Reply via email to