www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3068] New: concatenation operator doesn't like typed named enums

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

           Summary: concatenation operator doesn't like typed named enums
           Product: D
           Version: 1.045
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com


=== Testcase ===
enum Enum : ubyte
{
    Test
}

void main()
{
    ubyte[] array;
    array = array ~ [Enum.Test];
}
=== Compiler output ===
test.d(9): Error: incompatible types for ((array) ~
([cast(Enum)cast(ubyte)0u])): 'ubyte[]' and 'Enum[1u]'
test.d(9): Error: Can only concatenate arrays, not (int ~ int)
test.d(9): Error: cannot implicitly convert expression (__error ~ __error) of
type int to ubyte[]
=== Testcase end ===

This seems to be a very specific bug, in that changing many of the factors
allows the code to compile. For example, changing the concatenation to an
append (~=) or removing the enum name (Enum) will both allow the code to
compile. Removing the square brackets around Enum.Test has no effect.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 14 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3068


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |yebblies gmail.com
            Version|1.045                       |D1 & D2
         AssignedTo|nobody puremagic.com        |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2012-02-20 23:01:10 EST ---
https://github.com/D-Programming-Language/dmd/pull/747

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