Thread overview
[Issue 4737] New: enum breaks linker when passed to typeid()
Aug 26, 2010
Andrej Mitrovic
[Issue 4737] typeid doesn't work for scoped enum with initializer
May 21, 2011
Andrej Mitrovic
Apr 21, 2012
SomeDude
Apr 21, 2012
Andrej Mitrovic
Apr 21, 2012
SomeDude
Apr 21, 2012
Andrej Mitrovic
Dec 31, 2012
SomeDude
Dec 31, 2012
Andrej Mitrovic
Feb 10, 2013
Andrej Mitrovic
August 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4737

           Summary: enum breaks linker when passed to typeid()
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-08-26 14:34:39 PDT ---
module test;

import std.stdio;

unittest
{
    enum X { A = 3, B, C }
    X x;

    write(typeid(x));
    write(typeid(X));
}

void main()
{
}

 Error 42: Symbol Undefined _D4test11__unittest1FZv1X6__initZ

Sometimes it will compile, but then the app crashes and I get an access violation message in console.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 21, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4737


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|enum breaks linker when     |typeid doesn't work for
                   |passed to typeid()          |scoped enum with
                   |                            |initializer


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-20 19:11:53 PDT ---
typeid works with scoped enums, but not with ones that have an initializer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4737


SomeDude <lovelydear@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear@mailmetrash.com


--- Comment #2 from SomeDude <lovelydear@mailmetrash.com> 2012-04-21 15:29:34 PDT ---
Compiles and runs fine on 2.059 Win32

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4737



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-04-21 15:31:23 PDT ---
(In reply to comment #2)
> Compiles and runs fine on 2.059 Win32

No. Please remember to compile with -unittest.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4737



--- Comment #4 from SomeDude <lovelydear@mailmetrash.com> 2012-04-21 16:06:36 PDT ---
Oups, didn't see it. I guess it's time to go to bed... :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4737



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-04-21 16:15:22 PDT ---
(In reply to comment #4)
> Oups, didn't see it. I guess it's time to go to bed... :)

No worries. I was on a closing closing streak once ages ago and I ended up accidentally closing a bunch of DMD 1.x bugs because I couldn't recreate them in 2.x (I wasn't looking at the Version field above). They all had to be reverted to open again. :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4737



--- Comment #6 from SomeDude <lovelydear@mailmetrash.com> 2012-12-31 12:30:02 PST ---
http://dpaste.dzfl.pl/fork/7f894621

2.060
DMD: compilation failure
GDC: compiles and runs but no output
LDC: compiles and runs with the following output
     c19.__unittest1.X
     c19.__unittest1.X

(c19 being the execution instance)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4737



--- Comment #7 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-31 13:33:48 PST ---
(In reply to comment #6)
> GDC: compiles and runs but no output

DPaste might be using -unittest by mistake instead of -funittest for GDC. Run it with `gdc -m32 -funittest test.d && a.exe` and you'll see the output.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4737


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #8 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-09 22:20:38 PST ---
Resolved in 2.062 git-head by a pull for another report (dupe of this one).

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