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


Shin Fujishiro <rsi...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|Link error with typedefs of |Typedefs of the same name
                   |the same name in a function |cause initializer conflict
                   |scope                       |


--- Comment #1 from Shin Fujishiro <rsi...@gmail.com> 2010-05-28 04:51:17 PDT 
---
Maybe the example in #0 should be error.  I filed a separate bug 4245.

Still the problem exists.  As shown in the output example below, the two
distinct typedefs get mangled to the same name.  Then the assertion fails due
to the corrupted initial value.
-------------------- test.d
struct Struct(T) { T value; }
void foo()
{
    typedef int Number = 1;
    Struct!Number s;
    pragma(msg, typeof(s).mangleof);
    assert(s.value == 1);
}
void bar()
{
    typedef real Number = 2;
    Struct!Number s;
    pragma(msg, typeof(s).mangleof);
    assert(s.value == 2); // Assertion failure
}
void main() { foo(); bar(); }
--------------------
% dmd -run test
S4test20__T6StructTT6NumberZ6Struct
S4test20__T6StructTT6NumberZ6Struct
core.exception.asserter...@test(14): Assertion failure
--------------------

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

Reply via email to