Summary: Address-of operator fails on nested conditional
                    operator expression
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-03-30 13:43:22 PDT ---
The following (perfectly valid) D code is rejected by dmd:

int main(){
    int a;
    int *u=&(a ? a : (a ? a : a));
    return 0;

Error Message:
minimal.d(3): Error: incompatible types for ((&a) ? (&*(a ? &a : &a))): 'int*'
and 'int**'
minimal.d(3): Error: cannot implicitly convert expression (a ? __error :
(__error)) of type int* to int*

This is nonsense, clearly, the expression
(a ? a : (a ? a : a)) evaluates to a valid int lvalue, therefore it can have
the Address-of operator applied to it.

(For comparison: the following code compiles:
int main(){
    int a;
    (a ? a : (a ? a : a))=a;
    return 0;

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to