www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5168] New: String enums don't work with -g compiler switch

reply d-bugmail puremagic.com writes:
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



---
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: -------
Nov 05 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5168


johannes jo-t.de changed:

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



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: -------
Nov 15 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5168


SomeDude <lovelydear mailmetrash.com> changed:

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



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: -------
Apr 22 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5168




08:29:36 PDT ---

 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: -------
Apr 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5168




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: -------
Apr 23 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 27 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5168




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9f068b1b07aa9b2b3da7260ff1f5ed2615c1ae89


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: -------
Nov 29 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Feb 05 2013