Thread overview
[Issue 7874] New: [CTFE] CTFE internal error: unsupported assignment
Apr 09, 2012
timon.gehr@gmx.ch
[Issue 7874] [CTFE] internal error: unsupported assignment (x OP= y) = z
Apr 17, 2012
Don
Apr 21, 2012
timon.gehr@gmx.ch
Apr 21, 2012
SomeDude
Apr 22, 2012
timon.gehr@gmx.ch
April 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7874

           Summary: [CTFE] CTFE internal error: unsupported assignment
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE, rejects-valid
          Severity: minor
          Priority: P5
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: timon.gehr@gmx.ch


--- Comment #0 from timon.gehr@gmx.ch 2012-04-09 09:48:43 PDT ---
DMD 2.058, 2.059head:

int foo(int x){return ++x=1;}
enum bar = foo;

Error: CTFE internal error: unsupported assignment (x++ , x) = 1

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


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au
            Summary|[CTFE] CTFE internal error: |[CTFE] internal error:
                   |unsupported assignment      |unsupported assignment (x
                   |                            |OP= y) = z


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2012-04-17 01:43:48 PDT ---
Applies to many forms of op= assignment, including some cases of ref
assignment.
Eg.


int foo(int[] x){ auto b =  (x~=x)=[1,2,3]; return 3; }
enum bar = foo([7,5]);

-- 
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=7874



--- Comment #3 from timon.gehr@gmx.ch 2012-04-21 11:44:38 PDT ---
(In reply to comment #2)
> Actually, the first example gives on 2.059
> 
> PS E:\DigitalMars\dmd2\samples> dmd -c bug
> bug.d(2): Error: function bug.foo (int x) is not callable using argument types
> ()
> bug.d(2): Error: expected 1 function arguments, not 0

That is a typo. Fixed test case:

int foo(int x){return ++x=1;}
enum bar = foo(0);

-- 
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=7874



--- Comment #4 from SomeDude <lovelydear@mailmetrash.com> 2012-04-21 14:36:01 PDT ---
One could argue that the fact that such code is rejected is rather a good thing.

-- 
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=7874



--- Comment #5 from timon.gehr@gmx.ch 2012-04-22 09:44:30 PDT ---
That is not what this bug report is about. One can never argue that an ICE and spitting out of internal IR are good things.

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