[Issue 10487] Bad error message with assignment of const tuple

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 28 00:16:25 PDT 2013


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


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|DMD                         |Phobos
           Severity|normal                      |enhancement


--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2013-06-28 00:16:21 PDT ---
(In reply to comment #1)
> But if we copy-paste the Tuple implementation inline into the current module:
> 
[snip]
> 
> Then we get the simple error: 
> > Error: cannot modify const expression f
> 
> It looks like an implementation bug.

No. It's not a compiler bug. Following code missing in copy-paste code:

import std.traits;

template isTuple(T)
{
    static if (is(Unqual!T Unused : Tuple!Specs, Specs...))
    {
        enum isTuple = true;
    }
    else
    {
        enum isTuple = false;
    }
}

-------------

std.typecons.Tuple defines opAssign method, so compiler always try to call it
for assignment operation. So current error message is completely intended (even
if it looks a little verbose).

I change this to Phobos enhancement.

-- 
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