Thread overview
[Issue 5168] New: String enums don't work with -g compiler switch
Nov 05, 2010
Marcin Kuszczak
Nov 15, 2011
johannes@jo-t.de
Nov 16, 2011
Jesse Phillips
Apr 22, 2012
SomeDude
Apr 23, 2012
Jesse Phillips
Apr 23, 2012
SomeDude
Jul 26, 2012
Simen Kjaeraas
Nov 28, 2012
Rainer Schuetze
Feb 05, 2013
Andrej Mitrovic
November 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5168

           Summary: String enums don't work with -g compiler switch
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: aarti@interia.pl


--- Comment #0 from Marcin Kuszczak <aarti@interia.pl> 2010-11-05 06:09:04 PDT ---
Test case:

File: main_1.d
---------------------------
import std.stdio;
import main_1_ext_0;

void main() {
    writeln(Names.A);
}
---------------------------

File: main_1_ext_0.d
---------------------------
module main_1_ext_0;

enum Names : string {
    A = "Beauty",
    B = "Cinderella"
}
---------------------------

dmd.exe  -g    -IC:\DMD\DMD.2.049\\src\\phobos\ -IC:\DMD\DMD.2.049 -c main_1_ext_0.d -of.objs\main_1_ext_0.obj

main_1_ext_0.d(4): Error: Integer constant expression expected instead of
"Beauty"
main_1_ext_0.d(5): Error: Integer constant expression expected instead of
"Cinderella"
main_1_ext_0.d(4): Error: Integer constant expression expected instead of
"Beauty"
main_1_ext_0.d(5): Error: Integer constant expression expected instead of
"Cinderella"

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


johannes@jo-t.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johannes@jo-t.de


--- Comment #1 from johannes@jo-t.de 2011-11-15 13:27:39 PST ---
still present on 2.056 (running on Win7 x64).
however, problem happens only when enum is named.
for example, the following compiles fine:

enum : string
{
  a = "a",
  b = "b"
}

int main(string[] argv)
{
  writeln(a);
  return 0;
}



whereas the following fails:

enum X : string
{
  a = "a",  // Error: Integer constant expression expected
            //  instead of "a"
  b = "b"   // Error: Integer constant expression expected
            //  instead of "b"
}

int main(string[] argv)
{
  writeln(X.a);
  return 0;
}

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


Jesse Phillips <Jesse.K.Phillips+D@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Jesse.K.Phillips+D@gmail.co
                   |                            |m


--- Comment #2 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> 2011-11-16 09:04:05 PST ---
*** Issue 5985 has been marked as a duplicate of this issue. ***

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


SomeDude <lovelydear@mailmetrash.com> changed:

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


--- Comment #3 from SomeDude <lovelydear@mailmetrash.com> 2012-04-22 02:16:52 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 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5168



--- Comment #4 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> 2012-04-23 08:29:36 PDT ---
(In reply to comment #3)
> Compiles and runs fine on 2.059 Win32.

I'm still getting these errors

test.d(4): Error: Integer constant expression expected instead of "a"

when compiling the named enum version with -g option.

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



--- Comment #5 from SomeDude <lovelydear@mailmetrash.com> 2012-04-23 08:55:58 PDT ---
Indeed. I overlooked the -g option. Sorry for that.

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


Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com


--- Comment #6 from Simen Kjaeraas <simen.kjaras@gmail.com> 2012-07-26 14:16:09 PDT ---
*** Issue 8445 has been marked as a duplicate of this issue. ***

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


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario@gmx.de


--- Comment #7 from Rainer Schuetze <r.sagitario@gmx.de> 2012-11-27 22:31:46 PST ---
https://github.com/D-Programming-Language/dmd/pull/1331

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



--- Comment #8 from github-bugzilla@puremagic.com 2012-11-29 04:20:26 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9f068b1b07aa9b2b3da7260ff1f5ed2615c1ae89 Merge pull request #1331 from rainers/issue_5168

fix issue 5168: do not try to generate codeview debug info for non-integer enum

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |FIXED


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