www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3418] New: link error with cast(ulong)(ulong*real)

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

           Summary: link error with cast(ulong)(ulong*real)
           Product: D
           Version: 2.035
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: rinick gmail.com


--- Comment #0 from ZY Zhou <rinick gmail.com> 2009-10-19 02:13:05 PDT ---
test case:

ulong a = 1; 
a = cast(ulong)(a * 2.0L);

ERROR message: 

OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
C:\d\dmd2\windows\bin\..\lib\SNN.lib(u64_ldbl)  Offset FFE74H Record Type 0091
 Error 1: Previous Definition Different : ___LDBLULLNG

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 19 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3418



--- Comment #1 from Aldo Nunez <crimson.magus gmail.com> 2010-03-14 00:49:02
PST ---
Created an attachment (id=588)
test case with template use and comments

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 14 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3418


Aldo Nunez <crimson.magus gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crimson.magus gmail.com


--- Comment #2 from Aldo Nunez <crimson.magus gmail.com> 2010-03-14 00:49:48
PST ---
I get the same error, but in a slightly different context. I tried the case
from ZY Zhou on DMD 2.041, and it still fails.

The different case that I'm seeing is this.

This links fine.
    real y = 99.5L;
    ulong x = cast(ulong) y;

But if I put it after the following call, I get the link error.
    BinOp!(ulong, real).P( 99L );
    // where P is defined like this
    template BinOp(T, U)
    {
        void Q( U u )    {}
        void P( T t )    { Q( cast(U) t ); }
    }

Then compiling with -O gets rid of the error. I do have a case where the error
doesn't go away with the -O flag. The following is all in main.
    BinOp!(ulong, real).P( 99L );
    real y = 99.5L;
    void Q( ulong l )
    {
    }
    void P( real r )
    {
        Q( cast(ulong) r );
    }
    // B: -O doesn't fix this
    P( y );

Of course, getting rid of the BinOp.P call gets rid of the error as before.

Sorry if this is confusing. I've attached a file that might show this a little
more clearly. Picking line A or one line B by itself will not bring out the
error. It involves enabling A and one of the line Bs.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 14 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3418


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2010-09-03
01:35:02 PDT ---
http://www.dsource.org/projects/druntime/changeset/379

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