www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4206] New: type accepted as enum initializer

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

           Summary: type accepted as enum initializer
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario gmx.de> 2010-05-19 00:47:23
PDT ---
trying to compile the latet phobos revision, I've hit this assert:

std\bind.d(295): Error: static assert  (isTypeTuple!(Tuple!(int))) is false

which boils down to the template isExpressionTuple not returning the correct
value. This is caused by

alias int myint;
enum var = myint;

being accepted as correct syntax while "enum var = int;" is not.

This happens for every DMD version I have tested (latest svn, 2.046, 2.042,
1.056).

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


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com


--- Comment #1 from Stewart Gordon <smjg iname.com> 2010-05-27 19:36:23 PDT ---
Strange that you're getting this in 1.056 - I've always understood enums
without {} to be a D2-specific feature.  I certainly can't reproduce under
1.061.

But under 2.046:

----------
alias int myint;
enum var = myint;

pragma(msg, var);
pragma(msg, typeof(var));
----------
int
bz4206.d(5): Error: argument int to typeof is not an expression
void
----------

This should error at line 2 - myint is a type, not a value.

But I wonder if it's by any chance related to issue 2414.

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



--- Comment #2 from Rainer Schuetze <r.sagitario gmx.de> 2010-05-28 12:18:05
PDT ---
You're right, it correctly does not compile with dmd 1.056. I must have been
halucinating. Also, "enum { var = myint };" causes an error.

The use case that was failing with D2 is

pragma(msg, __traits(compiles, { enum var = myint; }));

and outputs "true".

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


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg gmail.com


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2011-06-19 04:06:19 PDT ---
On dmd 2.054 (d36b3b12fc4814e59f3a0d680b8700e787b1ceff), issue 2414 may have
been resolved. But "enum { var = myint };" does not cause an error. 

I think this issue does not depend on 2414,

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


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm gmail.com


--- Comment #4 from kennytm gmail.com 2011-06-19 04:48:25 PDT ---
*** Issue 5795 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: -------
Jun 19 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4206


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |yebblies gmail.com


--- Comment #5 from yebblies <yebblies gmail.com> 2011-07-03 05:15:26 EST ---
https://github.com/D-Programming-Language/dmd/pull/193

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4206


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #6 from Walter Bright <bugzilla digitalmars.com> 2011-10-07
16:30:11 PDT ---
https://github.com/D-Programming-Language/dmd/commit/3edf9b4a21a695278a20799c8aa15d4ba39796bc

https://github.com/D-Programming-Language/dmd/commit/8691884df888ba298b62e934b5aabac7b7eb8a8b

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