www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10784] New: Cannot initialize Nullable std.typecons.Tuple!(float,"x",float,"y",float,"z")

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10784

           Summary: Cannot initialize Nullable
                    std.typecons.Tuple!(float,"x",float,"y",float,"z")
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: alienballance gmail.com



16:54:53 PDT ---
http://dpaste.dzfl.pl/a968d7d1c

As for my understanding, the code i pasted should work like:
struct Coord
{
  float x;
  float y;
  float z;
}

void main()
{
  Nullable!Coord c = Coord(1f,2f,3f);
}

I'm sorry that i wont try to understand the reasons but i hope my bugreports
are helping.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 08 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10784


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com



It looks like nullable's constructor is marked as inout, which makes the
argument (in this case Tuple) marked as "const-qualified" in the body of the
function. The assignment itself is still legal, but the template constraint
"areCompatibleTuples" seems to be choking because of it. I think.

Either that, or it's this line in areCompatibleTuples:
auto result = mixin("lhs "~op~" rhs");

That "auto result =" is *partially* wrong: It was put there to check comparison
operators, but it shouldn't be there for assignment operator.

What I still need to investigate, is the interaction between both of these.

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